问题描述
我有一个使用source/target = 1.9/1.9的多模块Gradle Java项目.有两个模块, my.base 和 my.dependsOnBase . my.base 模块没有其他依赖项:
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;
}
my.dependsOnBase 模块只有一个依赖项,即 my.base :
The my.dependsOnBase module has only a single dependency, which is my.base:
module my.dependsOnBase {
requires my.base;
exports my.dependsOnBase.baz;
}
当我运行$ gradle javadoc
时,它可以在 my.base 上正常运行.但是当它到达 my.dependsOnBase 时,我得到以下错误输出:
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
在项目的早期,我能够使用以下方法来获得Java编译程序,该程序也遇到了类似的问题:
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()
}
}
但是这些属性并不直接适用于Gradle javadoc
任务.
But those properties aren't directly applicable to the Gradle javadoc
task.
如何使Javadoc正常工作?
How can I get my Javadoc working?
推荐答案
这对我有用
javadoc {
inputs.property("moduleName", moduleName)
doFirst {
options.addStringOption('-module-path', classpath.asPath)
}
}
这篇关于使"gradle javadoc" Java 9的任务工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!