我的root项目中有一个build.gradle,如下所示:
apply plugin: 'application'
apply plugin: 'java'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
allprojects {
repositories {
mavenCentral()
}
dependencies {
//....etc
}
}
mainClassName = "com.website.Main"
task stage {
dependsOn installDist
println "Running Stage"
}
task wrapper(type: Wrapper) {
gradleVersion = '2.7' //version required
}
然而,当我运行gradle stage
时,我得到了:
* What went wrong:
A problem occurred evaluating root project 'root-module'.
> Could not find property 'installDist' on task ':stage'.
奇怪的是,如果我运行.\gradlew stage
它运行正常......为什么会这样?