Getting to know Gradle — Installation

Rodrigo Mendes
4 min readAug 20, 2018

--

In these topics we will see how to install Gradle, configure environment variables in Windows and Linux in a few steps.

  1. First, we have to validate the pre-requisites to verify if Java JDK is installed. This is an important point: it has to be JDK, not the JRE, the version must be 6 or higher of Java so that Gradle works, there is no dependency of the Gradle library, because it has a library enclosed in its installation.
  2. We shall download the distribution of the Gradle site (https://gradle.org/gradle-download/?_ga=1.91279578.1571030533.1459526194 ).
  3. After the download, it is necessary to decompress the distribution ZIP file, this file contains:

a. Gradle´s binary

b. User´s Guide (HTML and PDF)

c. DSL Reference guide

d. Documentation regarding the API (Javadoc and Groovydoc)

e. An extensive list of examples, including those referenced in the user´s guide

f. The binary source code only for reference.

4. After this step, it is necessary to configure the environment variable:

Windows

  • Now, click directly in “Computer” and select “Properties”:
  • Click in “Advanced System Settings”
  • You should now be in the “Advanced” file, so click in “Environment Variables”
  • We want to add a new user variable which for us is called JAVA_HOME.
  • Now enter JAVA_HOME in the entrance field for “Variable name:”:
  • For “variable value:” we want to enter your Java JDK directory. The JDK Java in My Computer is located in the standard installation location, C:\Program Files\ Java\ jdk1.8.0_25
  • When done, click in “OK”
  • In “System Variables”, look for the “Variable” path
  • Now, we want to add additional paths for out environment variable PATH. So let´s click on “Edit” and in “Variables of the system” as shown below
  • Advance to the final value between locations \ bin of both Gradle and Java JDK
  • For Gradle, enter as C:\Gradle 4.9\bin. For Java JDK, enter only %JAVA_HOME%\bin because %JAVA_HOME% will use the user variable we defined previously to obtain the Java JDK directory for you
  • After you finish typing the new bin pathways for Gradle and JavaJDK, click on “OK”. Click on “OK” a few more times to exit
  • Execute Gradle-version to verify if it is still installed correctly

Linux

  • Extract the distribution file, or Gradle-x.x-bin.tar.gz to the directory you want to install Gradle. These instructions assume you chose /usr/local/gradle. The Gradle-x.x subdirectory will be created from the file
  • In a command terminal, add Gradle to you PATH variable: export PATH = /usr/local/gradle/gradle-x.x/ bin: $ PATH or for a more permanent configuration you can use the user profile: echo ‘export PATH=/usr/local/gradle/gradle-x.x/bin:$PATH’ >> $HOME/.bashrc
  • Certify that JAVA_HOME is defined for the location of your JDK, por example, export JAVA_HOME = /usr/java/jdk1.7.0_06 e que $ JAVA_HOME / bin is in your variable environment PATH
  • Execute Gradle-version to verify if it is installed correctly

Installation of the Plugin in Eclipse

  • Install Tools Eclipse Gradle (Buildship)
  • Installation through the market, the easiest way to install the set of Gradle Tools for Eclipse is using the client Eclipse for market and searching the Buildship.
  • Installation though the update manager for Eclipse: You can also use Help ▸ Install menu path New Software to install the Gradle tools
  • For example, the following URL may be used to free Eclipse 4,6 (neon)
  • http://download.eclipse.org/releases/neon

The Project Eclipse Gradle also supplies local updates, for example, the creating developer. See the download page for Buildship for more details:

--

--