This is for those who have set JavaScript in Gradle's javadoc.options.bottom
etc.
In Java 1.8.0_121, the javadoc command no longer allows JavaScript by default. http://www.oracle.com/technetwork/java/javase/8u121-relnotes-3315208.html
The javadoc tool will now reject any occurrences of JavaScript code in the javadoc documentation comments and command-line options, unless the command-line option, --allow-script-in-comments is specified.
I get an error when I run the javadoc task.
$ ./gradlew javadoc
[snip]
:javadoc
javadoc: error - Argument for -bottom contains JavaScript.
Use --allow-script-in-comments to allow use of JavaScript.
1 error
:javadoc FAILED
FAILURE: Build failed with an exception.
To enable JavaScript, add the --allow-script-in-comments
option as described in the error message above.
build.gradle
javadoc.options {
def v = JavaVersion.current()
def g = System.properties['java.version'] =~ /\d+/
addBooleanOption '-allow-script-in-comments', v.java9Compatible || v.majorVersion == '8' && g.size() == 4 && ((g[2] as int) > 0 || (g[3] as int) >= 121)
}
For the first argument of ʻaddBooleanOption, specify the option without the leading
-. In the second argument, specify the
boolean` value of whether to set the option.
If you specify this option in a Java environment of 1.8.0_121 or earlier, an error will occur when executing the javadoc task, so the Java version is used to determine whether to set the option.
that's all.
Gradle issue
https://github.com/gradle/gradle/issues/1393
Implementation of javadoc.options.addBooleanOption
https://github.com/gradle/gradle/blob/master/subprojects/language-java/src/main/java/org/gradle/external/javadoc/CoreJavadocOptions.java
https://github.com/gradle/gradle/blob/master/subprojects/language-java/src/main/java/org/gradle/external/javadoc/internal/JavadocOptionFile.java
https://github.com/gradle/gradle/blob/master/subprojects/language-java/src/main/java/org/gradle/external/javadoc/internal/BooleanJavadocOptionFileOption.java
Recommended Posts