I am building our Web-application using Maven Assembly plug-in. This is motivated by a requirement to extract some data out of special plug-ins. The fragment of assembly descriptor demonstrates this:
<dependencySet>
<unpack>true</unpack>
<scope>runtime</scope>
<useProjectArtifact>false</useProjectArtifact>
<includes>
<include>org.myproject.module:*:jar</include>
</includes>
<unpackOptions>
<includes>
<include>images/**</include>
<include>install/**</include>
<include>mappings/**</include>
</includes>
</unpackOptions>
<outputDirectory>./WEB-INF/myproject-modules/${artifact.name}</outputDirectory>
</dependencySet>
All plug-ins with groupId=org.myproject.module have this special treatment and extraction of module-specific folders.
Now, I have a requirement to build another WAR with exactly the same approach, but different set of modules. Is there any way to nicely extend my original POM, and simply add dependencies, without need to have a copy of my assembly descriptor(s) (stored in src/main/assembly)?
Simply extending pom fails with missing assembly descriptor, which is physically found in parent:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.3</version>
<configuration>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
</plugin>
</plugins>
</build>
There is an example of how to share assembly descriptors between projects in the assembly plugin docs. That should work if you’re not using assembly components; I’ve seen references to classpath issues when using components with this method.