Reputation: 1033
I am using Maven 2.0.9 to build a multi module project. I have defined the assembly plugin in my parent pom. I can get my assemblies built using
mvn install assembly:assembly
This command runs the tests twice, once during install phase and another during assembly. I tried assembly:single but it throws an error. Any help to get my assemblies built without running the tests twice is much appreciated.
Upvotes: 6
Views: 5334
Reputation: 84
You need to create a separate project for assembly in multi-module project. That separate module will just assembly - and it will have dependencies: siblings that should be added to result assembly.
Please read this article: http://www.sonatype.com/books/mvnref-book/reference/assemblies-sect-best-practices.html
Upvotes: 1
Reputation: 303
I think the error message is misleading , it suggests you need to run the "package" phase within the SAME maven invocation as the assembly plugin's invocation itself.
Did you try "mvn package assembly:assembly" or "mvn install assembly:assembly" ?
Works for me under Linux , JDK 1.6.0_16 , Maven 2.2.1 , Assembly Plugin 2.2-beta-4.
Upvotes: 1
Reputation: 570345
Invoking the assembly mojo will cause Maven to build the project using the normal lifecycle, up to the package
phase. So, when you run:
mvn install assembly:assembly
you are actually telling maven to run a few things twice and this includes the test phase as you can see in the documentation of the default lifecycle.
To avoid this, consider running only:
mvn assembly:assembly
Or bind the plugin on a project's build lifecycle:
<project>
...
<build>
...
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
...
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- append to the packaging phase. -->
<goals>
<goal>single</goal> <!-- goals == mojos -->
</goals>
</execution>
</executions>
</plugin>
...
</project>
Upvotes: 7