Maven Javadoc插件3.1.0无法生成聚合javadocs [英] Maven javadoc plugin 3.1.0 not generating aggregate 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.html
的apidocs
目录,但看不到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-plugin
的3.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中以
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.
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屋!