settings.gradle
是:
rootProject.name = 'snth'
include 'snth-proto-definition'
include 'snth-server'
include 'snth-client-guice'
snth-server/build.gradle
有:
sourceSets {
main {
java {
srcDir "${project(':snth-proto-definition').protobuf.generatedFilesBaseDir}/server/java"
}
}
}
snth-client/build.gradle
有:
sourceSets {
main {
java {
srcDir "${project(':snth-proto-definition').protobuf.generatedFilesBaseDir}/client/java"
}
}
}
但是,snth-server-guice/build.gradle
处理正常,snth-client-guice/build.gradle
错误:
FAILURE: Build failed with an exception.
* Where:
Build file 'snth/snth-client-guice/build.gradle' line: 14
* What went wrong:
A problem occurred evaluating project ':snth-client-guice'.
> Could not find property 'protobuf' on project ':snth-proto-definition'.
如何确保project(':snth-proto-definition').protobuf
在使用之前已定义?
答案 0 :(得分:0)
Configuration time dependencies表示使用evaluationDependsOn
可以更精细地控制子模块的配置顺序。例如:
evaluationDependsOn(':snth-proto-definition')