Gradle build can not find properties in parent files gradle.properties
source link: https://www.codesd.com/item/gradle-build-can-not-find-properties-in-parent-files-gradle-properties.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Gradle build can not find properties in parent files gradle.properties
I have multiple project gradle build and I am trying to externalize dependencies version via gradle.properties. Unfortunately child project can not find properties in parent gradle.properties
So in parent gradle.properties I have :
SPRING_VERSION=3.2.0.RELEASE
in parent build.gradle I have
dependencies {
compile "org.springframework:spring-webmvc:$SPRING_VERSION"
...
and this works fine. But in the child project same thing cause error :
Could not resolve all dependencies for configuration
Could not find org.springframework:spring-context-support:$SPRING_VERSION.
If I hardcode the version project builds fine.
also in parent file I have settings.gradle which specifies :
include 'projectA','projectB','projectC'
project structure
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
thanks for help
In Groovy, double-quoted Strings support String interpolation, whereas single-quoted Strings don't. Apparently, you mistakenly used a single-quoted String in the subproject. As a result, Gradle went searching for a version that is literally named $SPRING_VERSION
, which of course it didn't find.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK