Create a property for build script locations

(Dean Hiller) #1

I have the following code in one build.gradle file. NOTICE the line “classpath ‘org.webpieces:gradle-plugin-htmlcompiler:1.9.98’”

buildscript {

dependencies {
classpath ‘org.webpieces:gradle-plugin-htmlcompiler:1.9.98’
}
}

Then, I have this section in the master build.gradle file which is used by all the jar dependencies.

ext {
webpiecesVersion = ‘1.9.98’

}

How can I create a property that both of those things use so I only have to modify the version in one location?

thanks,
Dean

(Schalk Cronjé) #2

I believe project properties are available in the buildscript block, so you should be able to add a gradle.properties file to the root directory of your project and place the line foo=1.2.3 in there and then just use $foo where you need it.