Maven 2.x Assembly Plugin

Sharing a default assembly descriptor across sub modules does not work if invoked from parent project

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Won't Fix
  • Affects Version/s: 2.0.1
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    1

Description

I have a multi-project folders setup like one shown below,

root

_ sub-folder1
_ sub-folder2
_ sub-folder3
_ etc

Have a root pom.xml at the root folder level and in that I have defined
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/main/assembly/descriptor.xml
</descriptor>
</descriptors>
</configuration>
</plugin>

Above descriptor works fine only if I have defined a descriptor file on the src/main/assembly folder for each sub-folder1, sub-folder2, etc.
It would be great if maven supports me in defining a common assembly descriptor and can be shared by all the sub modules from a common location.

Issue Links

Activity

Hide
Stephen Evanchik added a comment -

Summary:

maven-assembly-plugin dependencies are only resolved in superpom's
pluginManagement section OR in the declaring POM.

Details:

My issue is that I started with a project structure of:

root -> sub-project -> sub-module

I have created a shared-project-assembly and installed it in the repository.

I configure the assembly plugin like so:

<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-2</version>
<dependencies>
<dependency>
<groupId>my-group</groupId>
<artifactId>shared-project-assembly</artifactId>
<version>0.0.1</version>
</dependency>
</dependencies>
<executions>
..... just like in the FAQ .....
</executions>
</plugin>

If I place that assembly configuration in a leaf project such as:

root -> sub-project -> sub-module-distribution

It only works if I invoke mvn package from sub-module-distribution.

If I invoke it from sub-project I receive the attached error.

However, if I place the plugin configuration in my superpom's pluginManagement
section it works just fine.

If I make a mistake in the dependency section of the assembly configuration,
such as:

<dependency>
<groupId>NOT_THE_RIGHT_GROUP</groupId>
<artifactId>shared-project-assembly</artifactId>
<version>0.0.1</version>
</dependency>

and execute mvn package from sub-project nothing happens, there is no error
indicating that Maven is unable to resolve artifact. If I move in to
sub-module-distribution and execute mvn package I receive the error indicating
that the artifact cannot be resolved.

Show
Stephen Evanchik added a comment - Summary: maven-assembly-plugin dependencies are only resolved in superpom's pluginManagement section OR in the declaring POM. Details: My issue is that I started with a project structure of: root -> sub-project -> sub-module I have created a shared-project-assembly and installed it in the repository. I configure the assembly plugin like so: <plugin> <artifactId>maven-assembly-plugin</artifactId> <version>2.2-beta-2</version> <dependencies> <dependency> <groupId>my-group</groupId> <artifactId>shared-project-assembly</artifactId> <version>0.0.1</version> </dependency> </dependencies> <executions> ..... just like in the FAQ ..... </executions> </plugin> If I place that assembly configuration in a leaf project such as: root -> sub-project -> sub-module-distribution It only works if I invoke mvn package from sub-module-distribution. If I invoke it from sub-project I receive the attached error. However, if I place the plugin configuration in my superpom's pluginManagement section it works just fine. If I make a mistake in the dependency section of the assembly configuration, such as: <dependency> <groupId>NOT_THE_RIGHT_GROUP</groupId> <artifactId>shared-project-assembly</artifactId> <version>0.0.1</version> </dependency> and execute mvn package from sub-project nothing happens, there is no error indicating that Maven is unable to resolve artifact. If I move in to sub-module-distribution and execute mvn package I receive the error indicating that the artifact cannot be resolved.
Hide
Stephen Evanchik added a comment -

File showing the error

Show
Stephen Evanchik added a comment - File showing the error
Hide
John Casey added a comment -

use either $(basedir)/src/../assembly.xml or else use a standardized, shared assembly descriptor as described in:

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

Show
John Casey added a comment - use either $(basedir)/src/../assembly.xml or else use a standardized, shared assembly descriptor as described in: http://maven.apache.org/plugins/maven-assembly-plugin/examples/sharing-descriptors.html

People

Vote (2)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: