我有多个项目 gradle 构建,我正在尝试通过外部化依赖项版本gradle.properties
。不幸的是,子项目无法在父项目中找到属性gradle.properties
所以在父母gradle.properties
I have:
SPRING_VERSION=3.2.0.RELEASE
在父母中build.gradle
I have:
dependencies {
compile "org.springframework:spring-webmvc:$SPRING_VERSION"
...
这很好用。但在子项目中同样的事情会导致错误:
Could not resolve all dependencies for configuration
Could not find org.springframework:spring-context-support:$SPRING_VERSION.
如果我对版本项目进行硬编码,则可以正常构建。
我也在父文件中settings.gradle
其中指定:
include 'projectA','projectB','projectC'
项目结构
root
|
\ buildSRC
\ projectA
|
\ build.gradle
\ projectB (build script in parent build.gradle)
\ projectC (build script in parent build.gradle)
|
|
\ build.gradle
\ gradle.properties
\ settings.gradle
在 Groovy 中,双引号字符串支持字符串插值,而单引号字符串则不支持。显然,您在子项目中错误地使用了单引号字符串。结果,Gradle 去寻找一个字面意思是的版本$SPRING_VERSION
,当然没有找到。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)