ngranin
ngranin

Reputation: 301

Option Xdoclint:none does not work in Gradle to ignore JavaDoc warnings?

I want to suppress Javadoc warnings in the output, because it fails the automatic builds.

task clientApiDocs(type: Javadoc) {
    source = sourceSets.main.allJava
    destinationDir = reporting.file("javadoc")
    classpath = configurations.compile
    options.addBooleanOption('Xdoclint:none', true)
}

This task will print some warnings:

User.java:124: warning - @param argument "password" is not a parameter name.
StateListener.java:17: warning - @author: is an unknown tag.

There are many of them, and It's not possible to fix them.

I tried to add options.addBooleanOption('Xdoclint:none', true) and options.addStringOption('Xdoclint:none', '-quiet') but this does not help. There are still Javadoc warnings in concole.

However, comparing to Ant, option <javadoc destdir="${dir.build}/doc" additionalparam="-Xdoclint:none"> works pretty well and does not print any warnings.

It seems like there are many of people who tried to solve the same problem, but there is no way to deal with it. E.g. link

What is the possible way or workaround to resolve it?

Upvotes: 4

Views: 1812

Answers (1)

soloturn
soloturn

Reputation: 1093

It's a pity that it cannot be switched off completely, the following 2 ways of reducing do get close though ... in build.gradle.kts, kotlin:

tasks.withType<Javadoc> {
    options {
        this as StandardJavadocDocletOptions
        addBooleanOption("Xdoclint:none", true)
        addStringOption("Xmaxwarns", "1")
    }
}

tasks.withType<Javadoc> {
    (options as StandardJavadocDocletOptions).addBooleanOption("Xdoclint:none", true) 
    (options as StandardJavadocDocletOptions).addStringOption("Xmaxwarns", "1")
}

Upvotes: 1

Related Questions