views:

65

answers:

1

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 sub-modules and I don't think it's a correct approach. When I'm running mvn javadoc:aggregate the documentation is generated 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?

+1  A: 

You need to enable aggregation for this plugin:

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

On the commandline type:

mvn javadoc:aggregate

Edit:

Okay, I did some digging into maven plugin's jira and found that all the javadoc plugin mojos have been annotated with @aggregator. But there seem to be problems with maven's aggregator the issue for which has been filed here

There are also related bugs here and here and some more

This seems to be a blocker issue with maven's aggregator since some plugins like e.g. clover wont run.

To to summarize, you are doing nothing wrong

Just switch back to earlier versions of maven-javadoc-plugin that does not use @aggregator mojo annotation and you will not get the warnings (unless you are using certain feature of the javadoc plugin thats not available in earlier version)

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

naikus
`aggregate` configuration parameter is deprecated: http://maven.apache.org/plugins/maven-javadoc-plugin/aggregate-mojo.html#aggregate
Vincenzo
@FaZend you had not specified the javadoc plugin version as well as maven version. Its deprecated in version 2.5. Anyway I was not aware of this fact
naikus
@FaZend.com, I've updated my answer with additional details
naikus
@naikus, I think that the problem is not in this particular plugin, but in my organization of multi-module project. The aggregating plugin is inherited by sub-modules and this is where the warning is reported.. I think that I need to re-organize my root project, but I don't know how. Btw, I switched to version 2.4 with the same result - I still have warnings but with other plugins (checkstyle, pmd, etc.). The problem is somewhere in the aggregation mechanism inside javadoc..
Vincenzo
@FaZend.com From the links of issues (already in the answer) the problem seems to be when a mojo is annotated with @aggregate annotation. IMO there's no special aggregation mechanism in javadoc plugin. This is caused for various other plugins too, like clover plugin. The maven aggregator causes problems with forked lifecycles. Do you have any of those in your project(s)? Looks like it works okay without any forked lifecycles
naikus