I have a multi-module Gradle Java project using source/target = 1.9/1.9. There are two modules, my.base and my.dependsOnBase. The my.base module has no other dependencies:
module my.base {
exports my.base.foo;
exports my.base.bar;
}
The my.dependsOnBase module has only a single dependency, which is my.base:
module my.dependsOnBase {
requires my.base;
exports my.dependsOnBase.baz;
}
When I run $ gradle javadoc
it works fine on my.base. But when it gets to my.dependsOnBase I get the following error output:
/path/to/my $ gradle javadoc
> Task :dependsOnBase:javadoc FAILED
/path/to/my/dependsOnBase/src/main/java/module-info.java:26: error: module not found: my.base
requires my.base;
^
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':dependsOnBase:javadoc'.
> Javadoc generation failed. Generated Javadoc options file (useful for troubleshooting): '/path/to/my/dependsOnBase/build/tmp/javadoc/javadoc.options'
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
7 actionable tasks: 3 executed, 4 up-to-date
Earlier in the project I was able to get Java compilation, which suffered a similar problem, working using:
compileJava {
inputs.property("moduleName", moduleName)
doFirst {
options.compilerArgs = [
'--module-path', classpath.asPath,
]
classpath = files()
}
}
But those properties aren't directly applicable to the Gradle javadoc
task.
How can I get my Javadoc working?
javadoc
task details used in the question? Also, did you try ensuring themy.base
module exists in the module path while executing that task as well? – Jarljavadoc
task modulepath within Gradle (blind copy/paste of thecompileJava
block definitely didn't work). I don't have an explicitjavadoc
task within mybuild.gradle
- I'm just using whatever thejava
plugin already provides. – Rahmann'org.gradle.java.experimental-jigsaw'
plugin, this problem is still happening as of Gradle 4.5.1. But the answer by @Thor Andreas Rognan
did work for me! – Milord