gradlejavadoc

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

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.


Solution

  • 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.