On 18/05/11 18:49, Eric Kolotyluk wrote:
My current structure is
+-- pom.xml
!
+--- mod1
+--- mod2 needs an assembly and depends on mod1& mod3
+--- mod3
+--- mod4 needs an assembly and depends on mod1& mod3
Executing the assembly plugin in mod2 and mod4 should work. I did this
in many builds and never experienced any problems. There're just some
things to care about:
The assembly plugin has to be bound to the package phase. This means,
that tere'll be 2 executions in that phase: jar:jar (or war:war or
whatever Your packaging implies) and assembly:single. Unfortunately
there's no defined behaviour for the execution sequence of 2 goal being
bound to the same phase. But I noticed that the plugins are executed in
the same order like they're defined in the POM. This means that you'll
(only) have to care for the order of the plugin declarations in Your
POM. And if there's not declaration for You POM's packaing plugin, You
could simply add an empty declaration:
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>assemble</id>
<goals><goal>single</goal></goals>
<phase>package</phase>
<configuration>
<appendAssemblyId>true</appendAssemblyId>
...
</configuration>
</execution>
</executions>
</plugin>
</plugins>
As the build now produces 2 artifacts, You should never omit the
classifier in the assembly archive's final name.
Once again: AFAIK this is *not a supported behaviour* - but it always
worked for me.
Are you saying I need to define something like
+-- pom.xml
!
+--- mod1
+--- mod2
+--- mod3
+--- mod4
+--- mod-ass2
+--- pom.xml (dependencies to mod1, mod2 and mod3)
+--- mod-ass4
+--- pom.xml (dependencies to mod1, mod3 and mod4)
How will that ensure that mod1, mod2, mod3, mod4 will pass through the
install phase, before mod-ass2 and mod-ass4 pass through the package
phase.?
The Maven reactor should do that automatically, if the required modules
for each assembly are declared as (compile or runtime) dependencies in
the POM.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]