tags:

views:

167

answers:

1

I have a main pom.xml which has multiple modules. These modules need to generate their own assemblies and have assembly plug-in and descriptor XML defined in their pom.xml.

Is it possible to invoke the assemblies of the modules from the main pom.xml?

+2  A: 

If the assembly plugin is bound to a lifecycle phase, it will be executed when the project is built, regardless of how the build is triggered.

To bind the execution, you would do something like below. The phase you bind it to depends on what your assembly is doing. See the Introduction to the Build Lifecycle for the available phases:

<plugin>
  <artifactId>maven-assembly-plugin</artifactId>
  <executions>
    <execution>
      <id>assemble</id>
      <phase>package</phase>
      <goals>
        <goal>assembly</goal>
      </goals>
    <execution>
  </executions>
  <configuration>
    ...
  </configuration>
</plugin>

If you want to execute the assembly only under certain circumstances. Put the assembly plugin configuration in a profile, and then it will be executed only when that profile is active. (If you make all the profiles have the same id - e.g. "assemble", then one profile activation at the command line will activate them all).

Rich Seller