Gradle properties using in config file


(Ndovan radytch) #1

i set in gradle.properties a value :
myJarVer.version=3.4.0
in the config file of on of the subprojects i want to do :
dependencies {
compile “org.slf4j:slf4j-api:${myJarVer.version}

}

how can it be set?


(James Justinic) #2

The property myJarVer.version is set to 3.4.0, but you cannot access it directly due to the dot in the property name. As written, the code looks for a nested version property on myJarVer. If you want to have a dot in the property name, you need to make sure that myJarVer.version as a whole is treated as the property name using syntax such as:

dependencies {
   compile "org.slf4j:slf4j-api:${property('myJarVer.version')}"
}

(Ndovan radytch) #3

Thanks!
this solved the issue