如何在多模块maven项目中正确使用javadoc:aggregate?
这是我在多模块项目中的父 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.
...
我做错了什么?
This is my parent pom.xml
file (part of it) in a multi-module project:
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</build>
...
This plugin is inherited in all sub-modules and I don't think it's a correct approach. When I'm running mvn javadoc:aggregate
the documentation is generated in target/site/apidoc
, but the log is full of warnings:
...
[WARNING] Removing: aggregate from forked lifecycle,
to prevent recursive invocation.
...
What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要为此插件启用聚合:
在命令行上输入:
编辑:
好的,我深入研究了 Maven 插件的 jira,发现所有 javadoc 插件 mojos 都已用 @aggregator 进行了注释。 提交了问题
但是maven的聚合器似乎存在问题,已在此处 还有相关错误此处和这里 以及更多
这似乎是一个拦截器问题使用 maven 的聚合器,因为某些插件(例如 clover)无法运行。
总而言之,您没有做错任何事情
只需切换回不使用 @aggregator mojo 注释的 maven-javadoc-plugin 的早期版本,您将不会收到警告(除非您正在使用某些功能)早期版本中不可用的 javadoc 插件)
顺便说一句,如果您将 javadoc 插件作为报告运行,则 @aggregator 将被忽略。
You need to enable aggregation for this plugin:
On the commandline type:
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.