Currently, my Gradle 5.6.2 project has a properties file located at:
gradle/wrapper/gradle-wrapper.properties
It looks like:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=file://localhost:/home/user1/.gradle/wrapper/dists/gradle-5.6.2-all/gradle-5.6.2-all.zip
So, when I run the gradle wrapper like so:
./gradlew clean build
It successfully downloads the gradle-5.6.2-all.zip file from my localhost with no problems.
However, now I would like to remove the reference absolute path to user1's home directory and instead do something like:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=file://localhost:~/.gradle/wrapper/dists/gradle-5.6.2-all/gradle-5.6.2-all.zip
However, it appears like Gradle takes the tilde ~ literally and complains the zip file does not exist. Instead of a tilde, I also tried doing:
distributionUrl=file://localhost:$HOME/.gradle/wrapper/dists/gradle-5.6.2-all/gradle-5.6.2-all.zip
distributionUrl=file://localhost:${HOME}/.gradle/wrapper/dists/gradle-5.6.2-all/gradle-5.6.2-all.zip
However, $HOME was also taken literally (i.e. it was not evaluated by Gradle to resolve "/home/user1" as I want).
Does anyone know how I can use my own environment variable in gradle-wrapper.properties file?