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.AbstractMojo;
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
import org.apache.maven.plugin.MojoFailureException;
|
|
||||||
import org.codehaus.plexus.archiver.ArchiverException;
|
import org.codehaus.plexus.archiver.ArchiverException;
|
||||||
import org.codehaus.plexus.archiver.UnArchiver;
|
import org.codehaus.plexus.archiver.UnArchiver;
|
||||||
import org.codehaus.plexus.archiver.manager.ArchiverManager;
|
import org.codehaus.plexus.archiver.manager.ArchiverManager;
|
||||||
|
@ -90,25 +89,16 @@ public abstract class AbstractUnpackingMojo
|
||||||
*/
|
*/
|
||||||
|
|
||||||
protected void unpack( File file, File location )
|
protected void unpack( File file, File location )
|
||||||
throws MojoExecutionException, MojoFailureException
|
throws MojoExecutionException, NoSuchArchiverException
|
||||||
{
|
{
|
||||||
String archiveExt = FileUtils.getExtension( file.getAbsolutePath() ).toLowerCase();
|
String archiveExt = FileUtils.getExtension( file.getAbsolutePath() ).toLowerCase();
|
||||||
|
|
||||||
this.getLog().info( "Look up archiver type: " + archiveExt );
|
try
|
||||||
|
{
|
||||||
UnArchiver unArchiver;
|
UnArchiver unArchiver;
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
unArchiver = this.archiverManager.getUnArchiver( archiveExt );
|
unArchiver = this.archiverManager.getUnArchiver( archiveExt );
|
||||||
}
|
|
||||||
catch ( NoSuchArchiverException e )
|
|
||||||
{
|
|
||||||
throw new MojoFailureException( "Unable to obtain unarchiver for extension '" + archiveExt + "'" );
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
unArchiver.setSourceFile( file );
|
unArchiver.setSourceFile( file );
|
||||||
|
|
||||||
unArchiver.setDestDirectory( location );
|
unArchiver.setDestDirectory( location );
|
||||||
|
|
|
@ -293,9 +293,17 @@ public class AssemblyMojo
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( process )
|
if ( process )
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
unpack( artifact.getFile(), tempLocation );
|
unpack( artifact.getFile(), tempLocation );
|
||||||
}
|
}
|
||||||
|
catch ( NoSuchArchiverException e )
|
||||||
|
{
|
||||||
|
throw new MojoExecutionException(
|
||||||
|
"Unable to obtain unarchiver for file '" + artifact.getFile() + "'" );
|
||||||
|
}
|
||||||
|
}
|
||||||
archiver.addDirectory( tempLocation, null,
|
archiver.addDirectory( tempLocation, null,
|
||||||
(String[]) getDefaultExcludes().toArray( EMPTY_STRING_ARRAY ) );
|
(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.artifact.Artifact;
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
import org.apache.maven.plugin.MojoFailureException;
|
import org.apache.maven.plugin.MojoFailureException;
|
||||||
|
import org.codehaus.plexus.archiver.manager.NoSuchArchiverException;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -62,9 +63,17 @@ public class UnpackMojo
|
||||||
if ( process )
|
if ( process )
|
||||||
{
|
{
|
||||||
File file = artifact.getFile();
|
File file = artifact.getFile();
|
||||||
|
try
|
||||||
|
{
|
||||||
unpack( file, tempLocation );
|
unpack( file, tempLocation );
|
||||||
}
|
}
|
||||||
|
catch ( NoSuchArchiverException e )
|
||||||
|
{
|
||||||
|
this.getLog().info( "Skip unpacking dependency file with unknown extension: " + file.getPath() );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue