Issue
I have a Maven multi module project like this:
foo-parent
foo-module
foo-module-new
foo-other-module1
foo-other-module2
pom.xml
And when calling mvn javadoc:aggregate
in foo-parent, I want to exclude the module foo-module from Javadoc generation.
Exclusion by package name with the parameter excludePackageNames
doesn't work in my case because foo-module and foo-module-new have the same package name.
Solution
Launch the following to generate javadocs only for foo-other-module1
and foo-other-module2
modules (note: always include the aggregator module, in this case foo-parent
):
mvn javadoc:aggregate -pl :foo-parent,:foo-other-module1,:foo-other-module2
Since Maven 3.2.1, you can also exclude modules from your reactor, so the above simplifies to
mvn javadoc:aggregate -pl '!foo-module'
Answered By - PaoloC