diff --git a/maven-plugins/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AbstractUnpackingMojo.java b/maven-plugins/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AbstractUnpackingMojo.java index 1c4d8197e2..b64e0428fa 100644 --- a/maven-plugins/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AbstractUnpackingMojo.java +++ b/maven-plugins/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AbstractUnpackingMojo.java @@ -18,7 +18,6 @@ package org.apache.maven.plugin.assembly; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; import org.codehaus.plexus.archiver.ArchiverException; import org.codehaus.plexus.archiver.UnArchiver; import org.codehaus.plexus.archiver.manager.ArchiverManager; @@ -90,25 +89,16 @@ public abstract class AbstractUnpackingMojo */ protected void unpack( File file, File location ) - throws MojoExecutionException, MojoFailureException + throws MojoExecutionException, NoSuchArchiverException { String archiveExt = FileUtils.getExtension( file.getAbsolutePath() ).toLowerCase(); - this.getLog().info( "Look up archiver type: " + archiveExt ); - - UnArchiver unArchiver; - try { + UnArchiver unArchiver; + unArchiver = this.archiverManager.getUnArchiver( archiveExt ); - } - catch ( NoSuchArchiverException e ) - { - throw new MojoFailureException( "Unable to obtain unarchiver for extension '" + archiveExt + "'" ); - } - try - { unArchiver.setSourceFile( file ); unArchiver.setDestDirectory( location ); diff --git a/maven-plugins/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AssemblyMojo.java b/maven-plugins/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AssemblyMojo.java index d5a2a3a16f..506a0407d0 100755 --- a/maven-plugins/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AssemblyMojo.java +++ b/maven-plugins/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AssemblyMojo.java @@ -294,7 +294,15 @@ public class AssemblyMojo if ( process ) { - unpack( artifact.getFile(), tempLocation ); + try + { + unpack( artifact.getFile(), tempLocation ); + } + catch ( NoSuchArchiverException e ) + { + throw new MojoExecutionException( + "Unable to obtain unarchiver for file '" + artifact.getFile() + "'" ); + } } archiver.addDirectory( tempLocation, null, (String[]) getDefaultExcludes().toArray( EMPTY_STRING_ARRAY ) ); diff --git a/maven-plugins/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/UnpackMojo.java b/maven-plugins/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/UnpackMojo.java index 0cad49a64d..b7d1368c07 100644 --- a/maven-plugins/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/UnpackMojo.java +++ b/maven-plugins/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/UnpackMojo.java @@ -19,6 +19,7 @@ package org.apache.maven.plugin.assembly; import org.apache.maven.artifact.Artifact; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; +import org.codehaus.plexus.archiver.manager.NoSuchArchiverException; import java.io.File; import java.util.Iterator; @@ -62,9 +63,17 @@ public class UnpackMojo if ( process ) { File file = artifact.getFile(); - unpack( file, tempLocation ); + try + { + unpack( file, tempLocation ); + } + catch ( NoSuchArchiverException e ) + { + this.getLog().info( "Skip unpacking dependency file with unknown extension: " + file.getPath() ); + } } } } + } \ No newline at end of file