The empty assemblies should be skipped in multimodule projects.
---------------------------------------------------------------
Key: MASSEMBLY-457
URL: http://jira.codehaus.org/browse/MASSEMBLY-457
Project: Maven 2.x Assembly Plugin
Issue Type: Bug
Affects Versions: 2.2-beta-5
Environment: Windows7, java1.6, maven 2.2.1 or Linux + Hudson 1.33x
Reporter: Kek
Priority: Critical
Attachments: patch.txt, test-modules.zip
Our workspace contains
- multimodule project (like in attached test-modules.zip)
- defined assembly on parent to zip src/main/config or src/test/config
folders and attach the zip to module
- but some child-modules could have empty config folders
than we obtain
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to create
assembly: Error creating assembly archive config: You must set at least one
file.
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at
org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to create
assembly: Error creating assembly archive config: You must set at least one
file.
at
org.apache.maven.plugin.assembly.mojos.AbstractAssemblyMojo.execute(AbstractAssemblyMojo.java:421)
at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
... 17 more
Caused by: org.apache.maven.plugin.assembly.archive.ArchiveCreationException:
Error creating assembly archive config: You must set at least one file.
at
org.apache.maven.plugin.assembly.archive.DefaultAssemblyArchiver.createArchive(DefaultAssemblyArchiver.java:194)
at
org.apache.maven.plugin.assembly.mojos.AbstractAssemblyMojo.execute(AbstractAssemblyMojo.java:370)
... 19 more
Caused by: org.codehaus.plexus.archiver.ArchiverException: You must set at
least one file.
at
org.codehaus.plexus.archiver.zip.AbstractZipArchiver.createArchiveMain(AbstractZipArchiver.java:272)
at
org.codehaus.plexus.archiver.zip.AbstractZipArchiver.execute(AbstractZipArchiver.java:250)
at
org.codehaus.plexus.archiver.AbstractArchiver.createArchive(AbstractArchiver.java:852)
at
org.apache.maven.plugin.assembly.archive.archiver.AssemblyProxyArchiver.createArchive(AssemblyProxyArchiver.java:496)
at
org.apache.maven.plugin.assembly.archive.DefaultAssemblyArchiver.createArchive(DefaultAssemblyArchiver.java:190)
... 20 more
I found the similar issue on maven-source-plugin:
http://jira.codehaus.org/browse/MSOURCES-44
So I suppose, that the problem could be solved in the same way.
May be, that this bug is duplicated with
http://jira.codehaus.org/browse/MASSEMBLY-420, but I'm not sure.
The similar problem was with previous version of maven-jar-plugin, but current
version is already repaired and works in same waz as maven-source-plugin. So we
use the maven-jar-plugin instead of assembly-plugin as workaround for this
issue. But there are empty jars created, so this is not ideal and I prefere to
use assembly-plugin.
It seems, that some incompatible changes was made to
org.codehaus.plexus.archiver.zip.AbstractZipArchiver.
So I look at sources and create some patch (attached to this issue) for
DefaultAssemblyArchiver, this solves our problem and could be tested on
test-modules.zip.
I know, there could be used a "skip" parameter for assembly deactivation in
submodules, but this solution is not effective for management in large projects
(we have about 1000 submodules). May be - some new parameter
"ignoreEmptyAssembly" should be added to switch on/off the behaviour of this
patch.
Sorry that I do not provide any Junit-test, I tried to implement one, but I
don“t know, how to use the EasyMock and extend existing
DefaultAssemblyArchiverTest, but I want to help, so the test-modules.zip for
simulation of the problem is attached. There are two child-modules, one
contains src/main/config with some file and the other is empty.
--
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