Build Gradle from source

Get the source

Either download the source distribution or check out Gradle from git.

Execute the Build

We use Gradle to build Gradle. But Gradle does not need to be installed on your machine to build it. The source tree contains a Gradle binary distribution capable of building Gradle. With the Gradle wrapper you can build Gradle via this internal Gradle distribution. Just go to the top level directory of the source tree and type:

Windows:
    gradlew clean assemble
*nix:
    ./gradlew clean assemble

In the build/distributions folder you can find the generated Gradle distributions. Note that you will need internet access the first time you run this, as the Gradle wrapper will download a number of dependencies the first time it runs.

The Gradle build is usually an early adopter of new Gradle features. If you want to build HEAD, it is therefore likely that you won't be able to build it with the last Gradle release. But you can simply use the wrapper scripts as described above.

To learn more about the Gradle wrapper and how you can use it for your own projects build with Gradle have a look at the user guide.

Installing Gradle with the Build

The Gradle build has an install task:
    ./gradlew clean install -Pgradle_installPath=someDir

The install task deletes any existing Gradle distribution at the specified destination. You specify the install destination with the gradle_installPath property. This property is interpreted relative to the source directory.

You can set this property in the gradle.properties file of your Gradle home directory (usually USER_HOME/.gradle). For how to set project properties you may have a look at the user guide.