问题
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