mirror of https://github.com/apache/maven.git
PR: MNG-1099
Submitted by: Dan Tran Reviewed by: Brett Porter only attempt to unpack known dependencies git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@306505 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
24a5bf4525
commit
fa968c9a87
|
@ -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 );
|
||||
|
||||
try
|
||||
{
|
||||
UnArchiver unArchiver;
|
||||
|
||||
try
|
||||
{
|
||||
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 );
|
||||
|
|
|
@ -293,9 +293,17 @@ public class AssemblyMojo
|
|||
}
|
||||
|
||||
if ( process )
|
||||
{
|
||||
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 ) );
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
try
|
||||
{
|
||||
unpack( file, tempLocation );
|
||||
}
|
||||
catch ( NoSuchArchiverException e )
|
||||
{
|
||||
this.getLog().info( "Skip unpacking dependency file with unknown extension: " + file.getPath() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue