1
说,你有以下任务:Gradle - 如何为Exec类型任务设置依赖项任务?
task commandA() {
doLast {
project.ext.ping = 'PING'
}
}
这将工作:
task commandB() {
dependsOn commandA
doLast {
println ping
}
}
这将失败:
task commandC(type: Exec) {
dependsOn commandA
commandLine "echo", ping
}
随着Could not find property 'ping' on task 'commandC'.
错误消息。
那么,如何声明exec类型任务的依赖关系并在该依赖关系中设置一些变量呢?