在我的构建脚本中,当我配置downloadAndUnzipFile
任务时,我明确地查询downloadZipFile
任务的输出。我预计这足以让 Gradle 推断任务之间的依赖关系,但显然不是,因为在调用 downloadAndUnzipFile 时出现错误。
Execution failed for task ':downloadAndUnzipFile'.
> Cannot expand ZIP '/home/jdanek/repos/testing/gradle-infer-deps/build/1.0.zip' as it does not exist.
我的构建脚本build.gradle.kts
是
import de.undercouch.gradle.tasks.download.Download
group = "org.example"
version = "1.0-SNAPSHOT"
plugins {
id("de.undercouch.download").version("4.0.4")
}
tasks {
val downloadZipFile by registering(Download::class) {
src("https://github.com/michel-kraemer/gradle-download-task/archive/1.0.zip")
dest(File(buildDir, "1.0.zip"))
}
val downloadAndUnzipFile by registering(Copy::class) {
from(zipTree(downloadZipFile.get().outputFiles.first()))
into(buildDir)
}
}
我也试过
from(zipTree(downloadZipFile.get().outputFiles.first()))
这也没有定义依赖关系。
我的 Gradle 是最新的 6.2.2。