问题
I have a multi-module project for which I'd like to generate aggregate javadoc reports. I am using maven-javadoc-plugin version 3.1.0. Here's the reporting section of pom.xml file:
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.1.0</version>
<reportSets>
<reportSet>
<id>non-aggregate</id>
<reports>
<report>javadoc</report>
</reports>
</reportSet>
<reportSet>
<id>aggregate</id>
<inherited>false</inherited>
<reports>
<report>aggregate</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
I am using mvn site:site site:stage goals to generate the javadoc reports. When I run this command, I expect to see apidocs directory containing index.html under target/site/ but I don't see apidocs directory.
What's interesting is if I switch to 3.0.1 version of maven-javadoc-plugin, aggregate javadocs are successfully generated.
I understand that there was a change to how aggregate reports are generated in 3.1.0 as documented here and I have used the same reporting setup.
Also, javadocs for individual modules are generated correctly for both versions of the plugin.
Other details:
- JDK 8
maven-site-pluginversion 3.7.1
回答1:
I finally found out what was causing this issue. I suspect that the cause was that in maven-javadoc-plugin version 3.1.0, there was a patch to fix Support aggregated reports at each level in the multi-module hierarchy.
This fix used the path defined in aggregator pom.xml to determine the outcome of canGenerateReport().
After investigating the modules defined in my aggregator pom.xml, I found that my modules were defined as:
<modules>
<module>./path/to/module1</module>
<module>./path/to/module2</module>
<module>./path/to/module3</module>
</modules>
The path had ./ in it that resulted in canGenerateReport() returning false. Removing ./ fixed the issue.
After the fix, my modules definition looks like:
<modules>
<module>path/to/module1</module>
<module>path/to/module2</module>
<module>path/to/module3</module>
</modules>
来源:https://stackoverflow.com/questions/56571385/maven-javadoc-plugin-3-1-0-not-generating-aggregate-javadocs