I am new to Gradle and am trying to create a configurable variable via the gradle.properties file.
To do this, I have created a gradle.properties
file at the root of my project, and defined a build directory like this:
buildDir="~/my/custom/build/directory"
In my build.gradle
file I have referenced the variable like this:
libsDirName = buildDir
This does not work. If I swap buildDir
for the string in gradle.properties
it builds to the correct location. Why is this happening?
Here is the complete build.gradle file:
plugins {
id 'java-library'
}
// This fails
libsDirName = buildDir
// This builds correctly
libsDirName = "~/my/custom/build/directory"
repositories {
jcenter()
}
dependencies {
api 'org.apache.commons:commons-math3:3.6.1'
implementation 'com.google.guava:guava:23.0'
testImplementation 'junit:junit:4.12'
}