Dependency outputdirectory ignored when unpack is specified
-----------------------------------------------------------
Key: MNG-1132
URL: http://jira.codehaus.org/browse/MNG-1132
Project: Maven 2
Type: Bug
Components: maven-assembly-plugin
Versions: 2.0-beta-3
Reporter: Jerome Lacoste
Priority: Critical
[I hope this can be looked into before official 2.0 otherwise that could create
issues with regard to breaking existing code. Making critical for this reason]
I am attempting to unpack in a particular place below the working directory.
Let's say I do something like
<dependencySet>
<outputDirectory>tomcat/webapp/</outputDirectory>
<includes>
<include>org.cb.project:webapp</include>
</includes>
<unpack>true</unpack>
<scope>runtime</scope>
</dependencySet>
The code in
maven-plugins/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AssemblyMojo.java
if ( dependencySet.isUnpack() )
{
// TODO: something like zipfileset in plexus-archiver
// archiver.addJar( )
File tempLocation = new File( workDirectory,
name.substring( 0, name.length() - 4 ) );
boolean process = false;
if ( !tempLocation.exists() )
{
tempLocation.mkdirs();
process = true;
}
else if ( artifact.getFile().lastModified() >
tempLocation.lastModified() )
{
process = true;
}
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 ) );
}
else
{
archiver.addFile( artifact.getFile(), output +
evaluateFileNameMapping(
dependencySet.getOutputFileNameMapping(), artifact ) );
}
This treats files to unpack and pack differently.
I believe
File tempLocation = new File( workDirectory,
name.substring( 0, name.length() - 4 ) );
should be replaced by something like:
File tempOutputLocation = new File( workDirectory,
output);
File tempLocation = new File( tempOutputLocation,
name.substring( 0, name.length() - 4 ) );
That way both code paths will end up treating the files similarly. If I change
from unpack to pack, my file end up in the same place. That sounds logical to
me.
Someone can still use <outputDirectory>/</outputDirectory> if he doesn't want
the files to be some levels below the work directory.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]