Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enable HTML5 Javadoc in Gradle

We have upgraded a Java project to JDK 10. When running the build script, Javadoc outputs a warning:

javadoc: warning - You have not specified the version of HTML to use.
The default is currently HTML 4.01, but this will change to HTML5
in a future release. To suppress this warning, please specify the
version of HTML used in your documentation comments and to be
generated by this doclet, using the -html4 or -html5 options.

For building the project, we use gradle. How can we specify HTML 5 (-html5) in gradle?

So far, the javadoc section of our build.gradle file is rather simple:

javadoc {
    include 'com/company/project/pkg/*'
}
like image 368
Ringo Store Avatar asked May 07 '18 20:05

Ringo Store


1 Answers

It's straightforward with options.addBooleanOption:

javadoc {
    include 'com/company/project/pkg/*'
    options.addBooleanOption('html5', true)
}

Note that you have to use addBooleanOption and not addStringOption. The latter one does not work without a value (such as "") and then produces an invalid command line.

like image 86
Codo Avatar answered Oct 18 '22 16:10

Codo