问题描述
我有一个gradle任务,像这样:
I have a gradle task like this:
task api(type: Javadoc) {
group = 'Documentation'
description = 'Generates the Javadoc API documentation.'
title = "${rootProject.description} ${version} API"
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
options.author = true
options.header = rootProject.description
options.overview = 'src/api/overview.html'
source = sourceSets.main.allJava
classpath = project.sourceSets.main.compileClasspath
destinationDir = new File(buildDir, "api")
}
但是当我运行命令-gradle api时,出现以下错误.
but when I run the command - gradle api I get the following error.
[错误] [system.err] javadoc:错误-读取文件overview.html时出错[QUIET] [system.out] 1个错误[DEBUG] [org.gradle.process.internal.DefaultExecHandle]将状态更改为:FAILED
[ERROR] [system.err] javadoc: error - Error while reading file overview.html[QUIET] [system.out] 1 error[DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: FAILED
您知道为什么它无法读取overview.html文件吗?
Any idea why this is failing to read the overview.html file?
该错误消息似乎具有误导性.我尝试使用不存在的文件执行任务,但仍然遇到相同的错误(错误消息中的文件名已更改)
It appears that this error message is misleading. I tried the task with a non-existent file and still getting the same error (with the file name changed in the error message)
感谢帮助!
推荐答案
看起来像您的Gradle任务无法找到overview.html文件的位置
Looks like your Gradle tasks not able to find the location of overview.html file
只需将此属性添加到build.grdle
Just add this property in build.grdle
javadoc {
options.overview = "src/main/java/overview.html"
}
并运行 ./gradlew javadoc
它为我成功执行了
这篇关于Gradle Javadoc插件错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!