Reputation: 69339
I have a multi-module Maven project. One of the modules is responsible for packaging up the outputs of all the other modules into one deliverable. I'm currently hitting a problem where my assembly is unable to gather the output from the other modules, failing with the message:
[WARNING] The following patterns were never triggered in this artifact
inclusion filter:
o '*:a'
A simplified version of my project layout is show below, where moduleA
is a project that builds a standard jar-with-dependencies output and moduleB
is my module responsible for packaging. The root-level pom.xml
lists moduleA
and moduleB
as modules.
parent
|- moduleA (foo:a)
|- pom.xml
|-src
|- ...
|- moduleB (foo:b)
|- pom.xml
|- src
|- main
|- assembly
|- assembly.xml
|- pom.xml
I have created an assembly descriptor for moduleB
that currently looks like this:
<assembly>
<id>dist</id>
<formats>
<format>tar.gz</format>
</formats>
<moduleSets>
<moduleSet>
<includes>
<include>*:a</include>
</includes>
<binaries>
<attachmentClassifier>jar-with-dependencies</attachmentClassifier>
<outputDirectory>package</outputDirectory>
<dependencySets>
<dependencySet>
<excludes>
<exclude>*:*</exclude>
</excludes>
</dependencySet>
</dependencySets>
</binaries>
</moduleSet>
</moduleSets>
</assembly>
I have also listed moduleA
as a dependency of moduleB
in moduleB
's pom.xml
file (compile scope). I have done this because I believe it will force moduleB
to be built after moduleA
; it appears to work.
Can anyone suggest why my moduleB
assembly is not gathering up the jar-with-dependencies output from moduleA
and complaining about the pattern never being triggered?
I have tried specifying the groupId of moduleA
(rather than using a wildcard) but it has not helped. I have also attempted to simplify the assembly descriptor for moduleB
as follows, without any change in result:
<assembly>
<id>dist</id>
<formats>
<format>tar.gz</format>
</formats>
<moduleSets>
<moduleSet>
<includes>
<include>foo:a</include>
</includes>
<binaries>
<outputDirectory>package</outputDirectory>
<dependencySets></dependencySets>
</binaries>
</moduleSet>
</moduleSets>
</assembly>
NEW: A SSCCE for this issue can be found here: http://dl.dropbox.com/u/108474287/parent.zip
Maven version: Apache Maven 2.2.1 (r801777; 2009-08-06 20:16:01+0100)
Upvotes: 1
Views: 3104
Reputation: 573
In my case I missed to include that module as the dependency in the POM and included in the src.xml only. It just another place to look at if you encounter the problem.
Upvotes: 0
Reputation: 48075
I think the problem is that you have a multi module project and you try to have a <moduleSet/>
referencing a sibling. From the Including Module Binaries you can find this text:
The new (since 2.2) useAllReactorProjects flag in the moduleSet section allows you to consume module binaries from child modules in a multimodule build. This is an important to resolve the conflict between Maven's build ordering and the old approach to module binaries, where the assembly was build from the parent POM.
So I updated your assembly file to this (added <useAllReactorProjects/>
) and got it working:
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>dist</id>
<formats>
<format>tar.gz</format>
</formats>
<moduleSets>
<moduleSet>
<useAllReactorProjects>true</useAllReactorProjects>
<includes>
<include>*:a</include>
</includes>
<binaries>
<outputDirectory>package</outputDirectory>
<dependencySets>
<dependencySet>
<excludes>
<exclude>*:*</exclude>
</excludes>
</dependencySet>
</dependencySets>
</binaries>
</moduleSet>
</moduleSets>
</assembly>
NB I have removed the tag <attachmentClassifier>jar-with-dependencies</attachmentClassifier>
since it is completely wrong.
The output is a .tar.gz
which I think is what you want to achieve although that jar-with-dependencies
is somewhat pointing in another direction. Not really clear to me what you want...
An alternative to the maven-assembly-plugin
could be to use the maven-shade-plugin
.
Upvotes: 1
Reputation: 7853
As per the Maven documentation, given the following project structure, and all appropriate module references in the parent POM:
+ parent (groupId: org.test, artifactId: parent)
|
+ child1 (groupId: org.test, artifactId: child1)
|
+ child2 (groupId: org.test, artifactId: child2)
We can select just the child1 module using the following moduleSet:
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
[...]
<moduleSets>
[...]
<moduleSet>
<includes>
<include>org.test:child1</include>
</includes>
</moduleSet>
</moduleSets>
[...]
</assembly>
I have never used wildcards in the includes option, can you mention the package instead of the wildcard?
Upvotes: 0