Maven 2.x Javadoc Plugin

AggregatorJavadocReport/AggregatorTestJavadocReport are used by default in aggregator and no reports are generated

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 2.5
  • Fix Version/s: 2.5
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    2

Description

In multimodule way, AggregatorJavadocReport/AggregatorTestJavadocReport are used by default. Due to the following in the code,

AbstractJavadocMojo.java
if ( aggregate && !project.isExecutionRoot() )
        {
            return;
        }

the report is skipped.

  1. javadoc-aggregation.patch
    12/Aug/08 1:41 PM
    6 kB
    Benjamin Bentmann
  2. MJAVADOC-212.patch
    12/Aug/08 12:57 PM
    2 kB
    Vincent Siveton

Issue Links

Activity

Hide
Vincent Siveton added a comment -

To reproduce it, go to plugin-tools or plugin-testing and run:

plugin-tools>mvn clean site:stage -DstagingDirectory=C:\target -X -Ddebug -Preporting 

You will see an empty maven-plugin-tools-api\apidocs\index.html or maven-plugin-tools-api\testapidocs\index.html

Show
Vincent Siveton added a comment - To reproduce it, go to plugin-tools or plugin-testing and run:
plugin-tools>mvn clean site:stage -DstagingDirectory=C:\target -X -Ddebug -Preporting 
You will see an empty maven-plugin-tools-api\apidocs\index.html or maven-plugin-tools-api\testapidocs\index.html
Hide
Vincent Siveton added a comment -

In fact, I noticed some warn like the following:

[INFO] Skipped "JavaDocs" report, file "apidocs/index.html" already exists for the English version.

So, AggregatorJavadocReport and JavadocReport are both used. It is normal IMHO since the PluginManager invokes all MavenReport.

Show
Vincent Siveton added a comment - In fact, I noticed some warn like the following:
[INFO] Skipped "JavaDocs" report, file "apidocs/index.html" already exists for the English version.
So, AggregatorJavadocReport and JavadocReport are both used. It is normal IMHO since the PluginManager invokes all MavenReport.
Hide
Vincent Siveton added a comment -

A solution could be to move the aggregate parameter into AggregatorJavadocReport/AggregatorTestJavadocReport or to create a new parameter, like aggregator, only for these mojos.

Show
Vincent Siveton added a comment - A solution could be to move the aggregate parameter into AggregatorJavadocReport/AggregatorTestJavadocReport or to create a new parameter, like aggregator, only for these mojos.
Hide
Vincent Siveton added a comment -

Proposed patch.
By default, AggregatorJavadocReport/AggregatorTestJavadocReport will never be called at least aggregator parameter is specified.

Show
Vincent Siveton added a comment - Proposed patch. By default, AggregatorJavadocReport/AggregatorTestJavadocReport will never be called at least aggregator parameter is specified.
Hide
Benjamin Bentmann added a comment - - edited

Another idea: Currently, the parameter "aggregate" controls the aggregation behavior of say "javadoc:javadoc". However, this is not reliable, proper aggregation also requires to collectively fork all projects in the reactor. This can only be achieved via the "@aggregator" mojo annotation. So I believe the natural solution is to query the existence of this annotation whereever the code now checks the "aggregate" parameter. Hence, I added a new method isAggregator() that mojos override to report their aggregating behavior.

The existing parameter "aggregate" is kept only for convenience during the site lifecycle. The implementation of canGenerateReport() will skip those reports whose aggregator flag doesn't match the value specified by the user via "aggregate". This should allow to run either JavadocReport or AggregateJavadocReport without the need for <reportSets>. The parameter is ignored when the mojos are invoked via cli or build lifecycle, i.e. "mvn javadoc:javadoc -Daggregate=true" will no longer produce aggregated output. Instead, users should call "mvn javadoc:aggregate". That's a break, but I believe that's the only correct way in terms of proper aggregation.

I haven't tested this yet, it's merely a sketch for discussion.

Show
Benjamin Bentmann added a comment - - edited Another idea: Currently, the parameter "aggregate" controls the aggregation behavior of say "javadoc:javadoc". However, this is not reliable, proper aggregation also requires to collectively fork all projects in the reactor. This can only be achieved via the "@aggregator" mojo annotation. So I believe the natural solution is to query the existence of this annotation whereever the code now checks the "aggregate" parameter. Hence, I added a new method isAggregator() that mojos override to report their aggregating behavior. The existing parameter "aggregate" is kept only for convenience during the site lifecycle. The implementation of canGenerateReport() will skip those reports whose aggregator flag doesn't match the value specified by the user via "aggregate". This should allow to run either JavadocReport or AggregateJavadocReport without the need for <reportSets>. The parameter is ignored when the mojos are invoked via cli or build lifecycle, i.e. "mvn javadoc:javadoc -Daggregate=true" will no longer produce aggregated output. Instead, users should call "mvn javadoc:aggregate". That's a break, but I believe that's the only correct way in terms of proper aggregation. I haven't tested this yet, it's merely a sketch for discussion.
Hide
Benjamin Bentmann added a comment -

Considering the penalty of the forked lifecycles during the site generation of every module caused by "@aggregator" on the new mojos, I would however assume that people will sooner than later user <reportSets> to disable them from running in child modules.

Show
Benjamin Bentmann added a comment - Considering the penalty of the forked lifecycles during the site generation of every module caused by "@aggregator" on the new mojos, I would however assume that people will sooner than later user <reportSets> to disable them from running in child modules.
Hide
Vincent Siveton added a comment -

Patch applied in r685691 and r685692, snapshot deployed.
Thanks!

Show
Vincent Siveton added a comment - Patch applied in r685691 and r685692, snapshot deployed. Thanks!

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: