How to use javadoc: aggregate correctly in maven multi-module project?

This is my parent pom.xml file (part of it) in a multi-module project:

 ... <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> </plugin> </plugins> </build> ... 

This plugin is inherited in all submodules, and I do not think it is correct. When I run mvn javadoc:aggregate , the documentation is created in target/site/apidoc , but the log is full of warnings:

 ... [WARNING] Removing: aggregate from forked lifecycle, to prevent recursive invocation. ... 

What am I doing wrong?

+6
maven-2 javadoc
source share
1 answer

You need to enable aggregation for this plugin:

  <plugin> <artifactId>maven-javadoc-plugin</artifactId> <configuration> <aggregate>true</aggregate> <!-- this enables aggretation --> </configuration> </plugin> 

At the command prompt, type:

 mvn javadoc:aggregate 

Edit:

Ok, I dug a little into the maven plugin jira and found that all the javadoc plugin mods were annotated using @aggregator. But there seems to be problems with the maven aggregator, an issue for which has been reported here

There are also related errors here and here and a few more

This seems to be a blocker problem with the maven aggregator, as some plugins, for example, clover, will not work.

To summarize, you are not doing anything wrong

Just revert to earlier versions of maven-javadoc-plugin that don’t use the @aggregator mojo annotation and you won’t receive a warning (unless you use a specific javadoc plugin function that is not available in an earlier version)

On a side note: If you ran the javadoc plugin as a report, then @aggregator is ignored.

+10
source share

All Articles