You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by "Jerome Lacoste (JIRA)" <ji...@codehaus.org> on 2005/10/08 00:41:11 UTC
[jira] Created: (MNG-1132) Dependency outputdirectory ignored when unpack is specified
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: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
[jira] Updated: (MNG-1132) Dependency outputdirectory ignored when unpack is specified
Posted by "Jerome Lacoste (JIRA)" <ji...@codehaus.org>.
[ http://jira.codehaus.org/browse/MNG-1132?page=all ]
Jerome Lacoste updated MNG-1132:
--------------------------------
Attachment: support_output_dir_with_unpack.diff
My first analysis was wrong. It's even simpler.
Tested in my project with the aforementionned assembly configuration.
> 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
> Fix For: 2.0-beta-4
> Attachments: support_output_dir_with_unpack.diff
>
>
> [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: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
[jira] Updated: (MNG-1132) Dependency outputdirectory ignored when unpack is specified
Posted by "Jerome Lacoste (JIRA)" <ji...@codehaus.org>.
[ http://jira.codehaus.org/browse/MNG-1132?page=all ]
Jerome Lacoste updated MNG-1132:
--------------------------------
Attachment: support_output_dir_with_unpack.diff
Patch had rotted. Impressive for a one liner :)
> 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
> Fix For: 2.0-beta-4
> Attachments: support_output_dir_with_unpack.diff, support_output_dir_with_unpack.diff
>
>
> [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: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
[jira] Updated: (MNG-1132) Dependency outputdirectory ignored when unpack is specified
Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
[ http://jira.codehaus.org/browse/MNG-1132?page=all ]
Brett Porter updated MNG-1132:
------------------------------
Fix Version: 2.0-beta-4
> 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
> Fix For: 2.0-beta-4
>
>
> [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: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
[jira] Closed: (MNG-1132) Dependency outputdirectory ignored when unpack is specified
Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
[ http://jira.codehaus.org/browse/MNG-1132?page=all ]
Brett Porter closed MNG-1132:
-----------------------------
Assign To: Brett Porter (was: John Casey)
Resolution: Fixed
applied
> 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
> Assignee: Brett Porter
> Priority: Critical
> Fix For: 2.0-beta-4
> Attachments: support_output_dir_with_unpack.diff, support_output_dir_with_unpack.diff
>
>
> [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: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
[jira] Commented: (MNG-1132) Dependency outputdirectory ignored when unpack is specified
Posted by "Jerome Lacoste (JIRA)" <ji...@codehaus.org>.
[ http://jira.codehaus.org/browse/MNG-1132?page=comments#action_48073 ]
Jerome Lacoste commented on MNG-1132:
-------------------------------------
Typo...
> This treats files to unpack and pack differently.
Should have been written:
> This treats files to unpack and files to not unpack differently.
> 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
> Fix For: 2.0-beta-4
>
>
> [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: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
[jira] Commented: (MNG-1132) Dependency outputdirectory ignored when unpack is specified
Posted by "Jerome Lacoste (JIRA)" <ji...@codehaus.org>.
[ http://jira.codehaus.org/browse/MNG-1132?page=comments#action_48080 ]
Jerome Lacoste commented on MNG-1132:
-------------------------------------
And before I forget, I didn't test what the code will do if no output directory is specified.
The Archiver interface is not specified (in javadoc at least), so I didn't know what the addDirectory without specified prefix would do.
The AbstractArchiver uses "" for the prefix, so I guess it shouldn't change the behavior if DependencySet.getOutputDirectory() returns an empty String when nothing has been specified.
> 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
> Fix For: 2.0-beta-4
> Attachments: support_output_dir_with_unpack.diff
>
>
> [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: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org