I would like to generate javadoc for my whole project using the aggregate goal but I would also like to generate javadoc jars for several sub-projects. In my parent pom.xml I added the following pluginManagement to allow sub-projects to generate javadoc jars easily:
<project>
...
<build>
<pluginManagement>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
...
Then in the sub-projects that need a javadoc jar I added:
<project>
...
<build>
<plugins>
<plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
...
So far so good. Now I wanted to use the aggregate goal to get a full set of javadoc so I added another reference to the javadoc plugin to the parent pom:
<project>
...
<build>
<plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
...
This causes the javadoc plugin to get pulled into every sub-project instead of just the few that need it. It seems that jar and aggregate goals work well independently but when used together they cause issues. Anyone solved something like this?
Thanks in advance!