Java Programming Tutorials

Java programming tutorials with many code examples!

Gradle install and setup

In this article we’ll show how to install Gradle and do basic Gradle setup to have working configuration for projects!

Gradle basic setup

  1. Download Gradle
  2. Unpack it to a directory

    $> unzip gradle-2.4-all.zip -d ~/programs
    
  3. Create environment variable GRADLE_HOME that points to the Gradle install directory.

    GRADLE_HOME=~/programs/gradle-2.4
    
    # In Linux it's best to add the following line to ~/.bashrc:
    export GRADLE_HOME=~/programs/gradle-2.4
    
  4. Add GRADLE_HOME/bin to the PATH variable to have gradle command available on command line from every directory:

    export PATH="${PATH}":"${GRADLE_HOME}/bin"
    
  5. Reload system variables or restart computer. In Linux you can just do source ~/.bashrc or restart the terminal.

Testing Gradle setup:

To verify that you’ve installed Gradle correctly run gradle –version in command line. It should give similar results:

$> gradle --version

------------------------------------------------------------
Gradle 2.4
------------------------------------------------------------

Build time:   2015-05-05 08:09:24 UTC
Build number: none
Revision:     5c9c3bc20ca1c281ac7972643f1e2d190f2c943c

Groovy:       2.3.10
Ant:          Apache Ant(TM) version 1.9.4 compiled on April 29 2014
JVM:          1.8.0_45 (Oracle Corporation 25.45-b02)
OS:           Linux 3.16.0-37-generic amd64
Share with the World!