use official gradle wrapper installed as system-wide
It is possible to use gradlew
installed as a system app, i.e. /usr/local/bin/gradlew
and specify a custom directory where the gradle binary zips are unzipped. First, /usr/local/bin/gradlew
will need to find gradle-wrapper.jar
and gradle-wrapper.properties
in /usr/local/share/java
. It probably makes the most sense to strip down the official gradlew
to the very basics since the official one supports every GNU/Linux Distro, Windows, OSX, etc. It would probably be a couple of lines, something like:
#!/bin/bash
APP_BASE_NAME=`basename "$0"`
CLASSPATH=/usr/local/share/java/gradle-wrapper.jar
JVM_OPTS="-Xmx1024m -Dfile.encoding=UTF-8 -Dorg.gradle.appname=$APP_BASE_NAME"
java ${JVM_OPTS} -classpath $CLASSPATH org.gradle.wrapper.GradleWrapperMain "$@"
By default, the various gradle binaries are unzipped into ~/.gradle/wrapper/dists
. But that directory is specified in gradle-wrapper.properties
, so it can be overridden:
- https://github.com/gradle/gradle/blob/REL_2.3/gradle/wrapper/gradle-wrapper.properties
- https://github.com/gradle/gradle/blob/REL_2.3/subprojects/wrapper/src/main/java/org/gradle/wrapper/WrapperExecutor.java
Then the subdir format is a little bizarre, but not too bad:
- subdir named after zipball, e.g.
gradle-1.12-bin/
- subdir that is an MD5 hash of the download URL in base36 (a-z0-9), here's an example URL:
https://services.gradle.org/distributions/gradle-1.12-bin.zip
- subdir from unzipped zipball, e.g.
gradle-1.12-bin/
-
.lck
and.ok
0 size files names after zipball, e.g.gradle-1.12-bin.zip.lck gradle-1.12-bin.zip.ok