如何在多模块Maven项目中正确使用javadoc:aggregate? [英] How to use javadoc:aggregate properly in multi-module maven project?
问题描述
这是我在多模块项目中的父pom.xml
文件(部分文件):
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</build>
...
此插件在所有子模块中都继承,我认为这不是正确的方法.当我运行mvn javadoc:aggregate
时,文档是在target/site/apidoc
中生成的,但是日志中充满了警告:
...
[WARNING] Removing: aggregate from forked lifecycle,
to prevent recursive invocation.
...
我在做什么错了?
您需要为此插件启用聚合:
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<aggregate>true</aggregate> <!-- this enables aggretation -->
</configuration>
</plugin>
在命令行上输入:
mvn javadoc:aggregate
好的,我对Maven插件的jira进行了深入研究,发现所有javadoc插件mojo都已使用@aggregator进行了注释.但是,maven的聚合器似乎存在问题,该问题已在此处提交. >
You need to enable aggregation for this plugin:
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<aggregate>true</aggregate> <!-- this enables aggretation -->
</configuration>
</plugin>
On the commandline type:
mvn javadoc:aggregate
Edit:
Okay, I did some digging into maven plugin's jira and found that all the javadoc plugin mojos have been annotated with @aggregator. But there seem to be problems with maven's aggregator the issue for which has been filed here
There are also related bugs here and here and some more
This seems to be a blocker issue with maven's aggregator since some plugins like e.g. clover wont run.
To to summarize, you are doing nothing wrong
Just switch back to earlier versions of maven-javadoc-plugin that does not use @aggregator mojo annotation and you will not get the warnings (unless you are using certain feature of the javadoc plugin thats not available in earlier version)
On a side note, If you run the javadoc plugin as report then the @aggregator is ignored.
这篇关于如何在多模块Maven项目中正确使用javadoc:aggregate?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!