[ 
http://jira.codehaus.org/browse/MASSEMBLY-468?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

John Casey closed MASSEMBLY-468.
--------------------------------

    Resolution: Won't Fix
      Assignee: John Casey

re-read 
http://maven.apache.org/plugins/maven-assembly-plugin/examples/sharing-descriptors.html

you need to use <descriptorRefs> not <descriptors> when using a standardized, 
shared descriptor like this.

> Sharing assembly descriptor across sub modules does not work if parent 
> defines assembly and submodule want to add own assembly
> ------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: MASSEMBLY-468
>                 URL: http://jira.codehaus.org/browse/MASSEMBLY-468
>             Project: Maven 2.x Assembly Plugin
>          Issue Type: Bug
>    Affects Versions: 2.2-beta-5
>         Environment: Win7 and CentOS Linux, SunJDK 1.6.0_u18, Maven 2.2.1
>            Reporter: Kek
>            Assignee: John Casey
>         Attachments: build-log.txt, maven-assembly-problem-project.zip
>
>
> The attached project simulates the problem where I have the multimodule 
> structure and shared assembly descriptor is used in parent-pom and another 
> shared assembly descriptor is used in one of the submodules. Than there is a 
> problem  - the assembly descriptor used in submodule is not found.
> The problem is in way how is the shared assembly descriptor specified in 
> assembly-plugin. For shared descriptors is the plugin <dependency> section 
> used - as described in 
> http://maven.apache.org/plugins/maven-assembly-plugin/examples/sharing-descriptors.html.
>         <plugin>
>           <artifactId>maven-assembly-plugin</artifactId>
>           <version>2.2-beta-5</version>
>           <dependencies>
>             <dependency>
>               <groupId>org.mycompany</groupId>
>               <artifactId>config-assembly-descriptor</artifactId>
>               <version>${project.version}</version>
>             </dependency>
>           </dependencies>
>           ....etc.
> But if you define this on parent pom, than it is not possible use this in the 
> same way for different shared assembly descriptor on some submodule. In my 
> example project, I define the assembly plugin with dependency on 
> data-assembly-descriptor in submodule and the following error occurres, 
> becase the new dependency on data-assembly-descriptor is in submodule always 
> ignored and only config-assembly-descriptor defined in parent will be used.
> [INFO] Error reading assemblies: Error locating assembly descriptor: 
> data-assembly.xml
> [1] [INFO] Searching for file location: 
> D:\root-module\my-modules\not-working-module\data-assembly.xml
> [2] [INFO] File: 
> D:\root-module\my-modules\not-working-module\data-assembly.xml does not exist.
> [3] [INFO] Invalid artifact specification: 'data-assembly.xml'. Must contain 
> at least three fields, separated by ':'.
> [4] [INFO] Failed to resolve classpath resource: assemblies/data-assembly.xml 
> from classloader: org.codehaus.classworlds.realmclassloa...@180cb01
> [5] [INFO] Failed to resolve classpath resource: data-assembly.xml from 
> classloader: org.codehaus.classworlds.realmclassloa...@180cb01
> [6] [INFO] File: D:\root-module\data-assembly.xml does not exist.
> [7] [INFO] Building URL from location: data-assembly.xml
> Error:
> java.net.MalformedURLException: no protocol: data-assembly.xml
>       at java.net.URL.<init>(URL.java:567)
>       at java.net.URL.<init>(URL.java:464)
>       at java.net.URL.<init>(URL.java:413)
>       at 
> org.apache.maven.shared.io.location.URLLocatorStrategy.resolve(URLLocatorStrategy.java:54)
>       at org.apache.maven.shared.io.location.Locator.resolve(Locator.java:81)
>       at 
> org.apache.maven.plugin.assembly.io.DefaultAssemblyReader.addAssemblyFromDescriptor(DefaultAssemblyReader.java:309)
>       at 
> org.apache.maven.plugin.assembly.io.DefaultAssemblyReader.readAssemblies(DefaultAssemblyReader.java:140)
>       at 
> org.apache.maven.plugin.assembly.mojos.AbstractAssemblyMojo.execute(AbstractAssemblyMojo.java:352)
>       at 
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
>       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)
> Some workaround that could be used on my project is to define all needed 
> shared assemblies descriptors on the same place in one shared root-parent-pom 
> in the way like:
>           <dependencies>
>             <dependency>
>               <groupId>org.mycompany</groupId>
>               <artifactId>config-assembly-descriptor</artifactId>
>               <version>${project.version}</version>
>             </dependency>
>             <dependency>
>               <groupId>org.mycompany</groupId>
>               <artifactId>data-assembly-descriptor</artifactId>
>               <version>${project.version}</version>
>             </dependency>
>           </dependencies>
> But the better way should be specification of shared assembly descriptor per 
> assembly execution.
> In my opinion there should be some possibility like this
>         <plugin>
>           <artifactId>maven-assembly-plugin</artifactId>
>           <version>2.2-beta-5</version>
>           <executions>
>             <execution>
>               <id>create-config-assembly</id>
>               <phase>package</phase>
>               <goals>
>                 <goal>single</goal>
>               </goals>
>           <dependencies>
>             <dependency>
>               <groupId>org.mycompany</groupId>
>               <artifactId>config-assembly-descriptor</artifactId>
>               <version>${project.version}</version>
>             </dependency>
>           </dependencies>
>               <configuration>
>                 <descriptors>
>                   <descriptor>config-assembly.xml</descriptor>
>                 </descriptors>
>               </configuration>
>             </execution>
>           </executions>
>         </plugin>
> OR some other variant with artifact specification in <descriptor> element:
>         <plugin>
>           <artifactId>maven-assembly-plugin</artifactId>
>           <version>2.2-beta-5</version>
>           <executions>
>             <execution>
>               <id>create-config-assembly</id>
>               <phase>package</phase>
>               <goals>
>                 <goal>single</goal>
>               </goals>
>               <configuration>
>                 <descriptors>
>                   <descriptor>
>                     <groupId>org.mycompany</groupId>
>                     <artifactId>config-assembly-descriptor</artifactId>
>                     <descriptor-file>config-assembly.xml</descriptor-file>
>                   </descriptor>
>                 </descriptors>
>               </configuration>
>             </execution>
>           </executions>
>         </plugin>

-- 
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

        

Reply via email to