I'm generating the javadoc using Java 11 and gradle for a project that does not use modules using the configuration below.
The documentation is generated correctly, but navigating to a search result yields a file not found instead of the expected page. There is an extra "undefined/" in the URL before the package and class name (e.g. ".../doc/undefined/package/Class.html").
There is a similar question for javadoc with Maven, but I cannot see how to add the --no-module-directories
option in gradle.
task allJavadoc (type: Javadoc, description: 'Generate javadoc from all projects', group: 'Documentation') {
destinationDir = file("$projectDir/doc")
title = "Title"
maxMemory = "2048m"
failOnError true
options.author false
options.version true
options.use true
options.links "https://docs.oracle.com/en/java/javase/11/docs/api/"
options.breakIterator true
subprojects.each { proj ->
proj.tasks.withType(Javadoc).each { javadocTask ->
classpath += javadocTask.classpath
excludes += javadocTask.excludes
includes += "**/*.java"
}
}
}
You need to add a boolean option with the leading hyphen removed:
options.addBooleanOption "-no-module-directories", true
Alternatively, if you're not defining a custom task:
javadoc {
doFirst {
options.addBooleanOption('-no-module-directories', true)
}
}
Adapted from a related post for specifying a module path.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With