Maven - 'all' or 'parent' project for aggregation?
- by disown
For educational purposes I have set up a project layout like so (flat in order to suite eclipse better):
-product
|
|-parent
|-core
|-opt
|-all
Parent contains an aggregate project with core, opt and all. Core implements the mandatory part of the application. Opt is an optional part. All is supposed to combine core with opt, and has these two modules listed as dependencies.
I am now trying to make the following artifacts:
product-core.jar
product-core-src.jar
product-core-with-dependencies.jar
product-opt.jar
product-opt-src.jar
product-opt-with-dependencies.jar
product-all.jar
product-all-src.jar
product-all-with-dependencies.jar
Most of them are fairly straightforward to produce. I do have some problem with the aggregating artifacts though. I have managed to make the product-all-src.jar with a custom assembly descriptor in the 'all' module which downloads the sources for all non-transitive deps, and this works fine. This technique also allows me to make the product-all-with-dependencies.jar.
I however recently found out that you can use the source:aggregate goal in the source plugin to aggregate sources of the entire aggregate project. This is also true for the javadoc plugin, which also aggregates through the usage of the parent project.
So I am torn between my 'all' module approach and ditching the 'all' module and just use the 'parent' module for all aggregation. It feels unclean to have some aggregate artifacts produced in 'parent', and others produced in 'all'. Is there a way of making an 'product-all' jar in the parent project, or to aggregate javadoc in the 'all' project? Or should I just keep both?
Thanks