Configure gradle build to suppress javadoc console warnings

笑着哭i 提交于 2021-01-02 12:49:20

问题


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);
                        ^

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.


回答1:


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.

See: https://blog.joda.org/2014/02/turning-off-doclint-in-jdk-8-javadoc.html

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.




回答2:


You could set the outputLevel inside the options block of the javadoc task but unfortunately, even the QUIET level won't be enough for you

Shuts off non-error and non-warning messages, leaving only the warnings and errors appear, making them easier to view.

So using the provided settings of the task, I think you are stuck.

Other solution : fix your javadoc issues.



来源:https://stackoverflow.com/questions/52205209/configure-gradle-build-to-suppress-javadoc-console-warnings

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!