Maven javadoc plugin 3.1.0 not generating aggregate javadocs

谁说胖子不能爱 提交于 2020-08-08 05:18:42

问题


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-plugin version 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!