Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Won't Fix
-
None
-
None
-
None
-
None
Description
Consider the following project structure:
- parent - pom.xml - assembly - pom.xml - module1 - pom.xml - module2 - pom.xml - module3 - pom.xml
As recommended here, the "assembly" sub-project exists to run the assembly plugin during package phase and depends on module1, module2, and module3 to achieve this.
Using <moduleSet>/<binaries> I can include all of the compiled binaries from module1, module2, and module3 in the assembly. Using <moduleSet>/<sources> I can likewise include all of the sources, but the problem is that <sources> actually includes the entire source directories including POM and project files for each module, which is not always desired.
Modules 1-3 in this case use the maven-source-plugin to create source binaries ([artifactId]-[version]-sources.jar). I want to include those source JARs in the assembly. However, I cannot do this with <moduleSet> or with <dependencySet>. I have to add a <fileSet> for each module's lone source JAR, like so:
<fileSet> <directory>../module1/target</directory> <includes><include>*-sources.jar</include></includes> <outputDirectory>/sources</outputDirectory> </fileSet> <fileSet> <directory>../module2/target</directory> <includes><include>*-sources.jar</include></includes> <outputDirectory>/sources</outputDirectory> </fileSet> <fileSet> <directory>../module3/target</directory> <includes><include>*-sources.jar</include></includes> <outputDirectory>/sources</outputDirectory> </fileSet>
This gets tedious with many modules (and really shouldn't be necessary). We either need a <sourceBinaries> option that works similarly to <binaries> except on source JARs, or <binaries> needs to be changed to optionally support source JARs.