配置gradle构建以禁止Javadoc控制台警告 [英] Configure gradle build to suppress javadoc console warnings
问题描述
I'm configuring a gradle build using gradle's javadoc plugin. I was able to stop the build from failing on account of javadoc lint errors, but there are still hundreds of lines of console output for those lint errors that I don't care about.
有什么主意如何隐瞒这些与棉绒相关的控制台消息?
Any ideas how to suppress these console messages related to linting?
我正在谈论的示例输出(但屏幕和屏幕已满):
Example output that I'm talking about (but screens and screens full):
/home/user/projects/my-project/src/main/java/my/package/MyObject.java:89: warning: no description for @param
* @param myParam
^
/home/user/projects/my-project/src/main/java/my/package/MyObject.java:90: warning: no description for @return
* @return
^
/home/user/projects/my-project/src/main/java/my/package/MyObject.java:101: warning: no @param for itemId
List<MyItem> getMyItems(Long itemId);
^
我需要澄清的是,我正在寻找构建配置中的解决方案,而不是每次运行时都传递给gradle build
命令的标志.
I should clarify, I'm looking for a solution within the build configuration—not a flag to pass to the gradle build
command every time I run it.
推荐答案
可以使用Xdoclint选项抑制警告/错误:
The warnings/errors can be suppressed using the Xdoclint option:
javadoc.options.addStringOption('Xdoclint:none', '-quiet')
这仍然会显示一些最糟糕的警告,但会消除绝大多数警告.
This will still show a few of the worst warnings, but will remove the vast majority of them.
请参阅: https://blog.joda.org/2014/02/turning-off-doclint-in-jdk-8-javadoc.html
顺便说一句,根据gradle javadoc文档,您可以直接设置输出级别(VERBOSE或QUIET).问题在于,QUIET仍会显示所有警告和错误消息,并且似乎仍然是默认行为.
As an aside, according to the gradle javadoc documentation you can set the output level directly (VERBOSE or QUIET). The problem is that QUIET still shows all warning and error messages and seems to be the default behavior anyway.
这篇关于配置gradle构建以禁止Javadoc控制台警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!