Chapter 3. Getting Started

3.1. Prerequisites

Gradle requires a Java JDK to be installed. Gradle ships with its own Groovy library, therefore no Groovy needs to be installed. Any existing Groovy installation is ignored by Gradle. The standard Gradle distribution requires a JDK 1.5 or higher. We also provide a distinct JDK 1.4 compatible distribution.

Gradle uses whichever JDK it finds in your path (to check, use java -version). Alternatively, you can set the JAVA_HOME environment variable to point to the install directory of the desired JDK.

3.2. Download

You can download one of the Gradle distributions from the Gradle web site.

3.3. Unpacking

The Gradle distribution comes packaged as a ZIP. The full distribution contains:

  • The Gradle binaries.

  • The user guide (HTML and PDF).

  • The API documentation (Javadoc and Groovydoc).

  • Extensive samples, including the examples referenced in the user guide, along with some complete and more complex builds you can use the starting point for your own build.

  • The binary sources (If you want to build Gradle you need to download the source distribution or checkout the sources from the source repository).

For Un*x users

You need a GNU compatible tool to unzip Gradle, if you want the file permissions to be properly set. We mention this as some zip front ends for Mac OS X don't restore the file permissions properly.

3.4. Environment variables

For running Gradle, add GRADLE_HOME/bin to your PATH environment variable. Usually, this is sufficient to run Gradle. Optionally, you may also want to set the GRADLE_HOME environment variable to point to the root directory of your Gradle installation.

3.5. Running and testing your installation

You run Gradle via the gradle command. To check if Gradle is properly installed just type gradle -v and you should get an output like:

------------------------------------------------------------
Gradle 0.8
------------------------------------------------------------

Gradle buildtime: Monday, September 28, 2009 1:53:43 PM CEST
Groovy: 1.6.4
Ant: Apache Ant version 1.7.0 compiled on December 13 2006
Ivy: 2.1.0-rc2
Java: 1.6.0_15
JVM: 14.1-b02-90
JVM Vendor: Apple Inc.
OS Name: Mac OS X

3.6. JVM options

JVM options for running Gradle can be set via environment variables. You can use GRADLE_OPTS or JAVA_OPTS. Those variables can be used together. JAVA_OPTS is by convention an environment variable shared by many Java applications. A typical use case would be to set the HTTP proxy in JAVA_OPTS and the memory options in GRADLE_OPTS. Those variables can also be set at the beginning of the gradle or gradlew script.