From 933c977d136edfbbb667230e294ed5980f9587e2 Mon Sep 17 00:00:00 2001 From: Michal Srb <msrb@redhat.com> Date: Mon, 6 May 2013 12:40:44 +0200 Subject: [PATCH 1/2] Update maven-archiver to 2.5 --- pom.xml | 2 +- src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractHpiMojo.java | 7 ++----- src/main/java/org/jenkinsci/maven/plugins/hpi/HpiMojo.java | 4 ++-- src/main/java/org/jenkinsci/maven/plugins/hpi/HplMojo.java | 4 ++-- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index 0668768..d172bfc 100644 --- a/pom.xml +++ b/pom.xml @@ -144,7 +144,7 @@ <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-archiver</artifactId> - <version>2.0.1</version> + <version>2.5</version> </dependency> <dependency> <groupId>org.codehaus.plexus</groupId> diff --git a/src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractHpiMojo.java b/src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractHpiMojo.java index 6fb445e..2d6dfb3 100644 --- a/src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractHpiMojo.java +++ b/src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractHpiMojo.java @@ -31,7 +31,7 @@ import org.apache.maven.project.MavenProjectBuilder; import org.codehaus.plexus.archiver.ArchiverException; import org.codehaus.plexus.archiver.UnArchiver; import org.codehaus.plexus.archiver.jar.Manifest.Attribute; -import org.codehaus.plexus.archiver.jar.Manifest.Section; +import org.codehaus.plexus.archiver.jar.Manifest.ExistingSection; import org.codehaus.plexus.archiver.jar.ManifestException; import org.codehaus.plexus.archiver.manager.ArchiverManager; import org.codehaus.plexus.archiver.manager.NoSuchArchiverException; @@ -645,9 +645,6 @@ public abstract class AbstractHpiMojo extends AbstractJenkinsMojo { unArchiver.setDestDirectory(location); unArchiver.extract(); } - catch (IOException e) { - throw new MojoExecutionException("Error unpacking file: " + file + "to: " + location, e); - } catch (ArchiverException e) { throw new MojoExecutionException("Error unpacking file: " + file + "to: " + location, e); } @@ -900,7 +897,7 @@ public abstract class AbstractHpiMojo extends AbstractJenkinsMojo { } - protected void setAttributes(Section mainSection) throws MojoExecutionException, ManifestException, IOException { + protected void setAttributes(ExistingSection mainSection) throws MojoExecutionException, ManifestException, IOException { File pluginImpl = new File(project.getBuild().getOutputDirectory(), "META-INF/services/hudson.Plugin"); if(pluginImpl.exists()) { BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(pluginImpl),"UTF-8")); diff --git a/src/main/java/org/jenkinsci/maven/plugins/hpi/HpiMojo.java b/src/main/java/org/jenkinsci/maven/plugins/hpi/HpiMojo.java index fe2878e..020194b 100644 --- a/src/main/java/org/jenkinsci/maven/plugins/hpi/HpiMojo.java +++ b/src/main/java/org/jenkinsci/maven/plugins/hpi/HpiMojo.java @@ -24,7 +24,7 @@ import org.apache.maven.project.MavenProjectHelper; import org.codehaus.plexus.archiver.ArchiverException; import org.codehaus.plexus.archiver.jar.JarArchiver; import org.codehaus.plexus.archiver.jar.Manifest; -import org.codehaus.plexus.archiver.jar.Manifest.Section; +import org.codehaus.plexus.archiver.jar.Manifest.ExistingSection; import org.codehaus.plexus.archiver.jar.ManifestException; import org.codehaus.plexus.util.IOUtil; @@ -180,7 +180,7 @@ public class HpiMojo extends AbstractHpiMojo { PrintWriter printWriter = null; try { Manifest mf = ma.getManifest(project, archive.getManifest()); - Section mainSection = mf.getMainSection(); + ExistingSection mainSection = mf.getMainSection(); setAttributes(mainSection); printWriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(manifestFile),"UTF-8")); diff --git a/src/main/java/org/jenkinsci/maven/plugins/hpi/HplMojo.java b/src/main/java/org/jenkinsci/maven/plugins/hpi/HplMojo.java index 45f0d02..a8650fa 100644 --- a/src/main/java/org/jenkinsci/maven/plugins/hpi/HplMojo.java +++ b/src/main/java/org/jenkinsci/maven/plugins/hpi/HplMojo.java @@ -8,7 +8,7 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.codehaus.plexus.archiver.jar.Manifest; import org.codehaus.plexus.archiver.jar.Manifest.Attribute; -import org.codehaus.plexus.archiver.jar.Manifest.Section; +import org.codehaus.plexus.archiver.jar.Manifest.ExistingSection; import org.codehaus.plexus.archiver.jar.ManifestException; import org.codehaus.plexus.util.IOUtil; @@ -51,7 +51,7 @@ public class HplMojo extends AbstractHpiMojo { PrintWriter printWriter = null; try { Manifest mf = new Manifest(); - Section mainSection = mf.getMainSection(); + ExistingSection mainSection = mf.getMainSection(); setAttributes(mainSection); // compute Libraries entry -- 1.8.1.4