Maven Javadoc插件3.1.0无法生成聚合javadocs [英] Maven javadoc plugin 3.1.0 not generating aggregate javadocs

查看:191
本文介绍了Maven Javadoc插件3.1.0无法生成聚合javadocs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个多模块项目,我想为其生成汇总的Javadoc报告.我正在使用maven-javadoc-plugin版本3.1.0.这是pom.xml文件的报告部分:

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>

我正在使用mvn site:site site:stage目标来生成javadoc报告.运行此命令时,我希望在target/site/下看到包含index.htmlapidocs目录,但看不到apidocs目录.

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.

有趣的是,如果我切换到maven-javadoc-plugin3.0.1版本,则会成功生成聚集的Javadocs.

What's interesting is if I switch to 3.0.1 version of maven-javadoc-plugin, aggregate javadocs are successfully generated.

我了解到,在3.1.0中以aggregate报告的方式有所变化. html"rel =" nofollow noreferrer>此处记录,并且我使用了相同的报告设置.

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.

此外,针对两个插件版本均正确生成了各个模块的javadocs.

Also, javadocs for individual modules are generated correctly for both versions of the plugin.

其他详细信息:

  • JDK 8
  • maven-site-plugin版本3.7.1
  • JDK 8
  • maven-site-plugin version 3.7.1

推荐答案

我终于找到了导致此问题的原因.我怀疑,原因是在maven-javadoc-plugin版本3.1.0中,有一个修补程序可以修复

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.

此修复程序使用聚合器pom.xml中定义的路径来确定

This fix used the path defined in aggregator pom.xml to determine the outcome of canGenerateReport().

研究了聚合器pom.xml中定义的模块后,我发现我的模块定义为:

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>

路径中包含./,导致canGenerateReport()返回false.删除./可以解决此问题.

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>

这篇关于Maven Javadoc插件3.1.0无法生成聚合javadocs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆