Gradle 用户手册示例失败
Gradle user manual example failure
试图遵循官方 gradle 6.3 用户手册我遇到了一个不起作用的例子。
build.gradle:
project('projectA') {
task taskX {
dependsOn ':projectB:taskY'
doLast {
println 'taskX'
}
}
}
project('projectB') {
task taskY {
doLast {
println 'taskY'
}
}
}
但是如果我 运行 gradle -q taskX
我得到:
FAILURE: Build failed with an exception.
* Where:
Build file '[path_to_gradle_file]/build.gradle' line: 1
* What went wrong:
A problem occurred evaluating root project 'dependency'.
> Project with path 'projectA' could not be found in root project 'dependency'.
对于这种情况下的多项目 gradle 脚本,需要 settings.gradle
和:
include 'projectA', 'projectB'
试图遵循官方 gradle 6.3 用户手册我遇到了一个不起作用的例子。 build.gradle:
project('projectA') {
task taskX {
dependsOn ':projectB:taskY'
doLast {
println 'taskX'
}
}
}
project('projectB') {
task taskY {
doLast {
println 'taskY'
}
}
}
但是如果我 运行 gradle -q taskX
我得到:
FAILURE: Build failed with an exception.
* Where:
Build file '[path_to_gradle_file]/build.gradle' line: 1
* What went wrong:
A problem occurred evaluating root project 'dependency'.
> Project with path 'projectA' could not be found in root project 'dependency'.
对于这种情况下的多项目 gradle 脚本,需要 settings.gradle
和:
include 'projectA', 'projectB'