English 中文(简体)
Gradle – Installation
  • 时间:2024-10-18

Gradle - Installation


Previous Page Next Page  

Gradle is a build tool based on java. There are some prerequisites that are required to be installed before instalpng the Gradle frame work.

Prerequisites to install Gradle

JDK and Groovy are the prerequisites for Gradle installation.

Gradle requires JDK version 6 or later to be installed in the system. It uses the JDK pbraries which are installed, and sets to the JAVA_HOME environmental variable.

Gradle carries its own Groovy pbrary, therefore, we need not install Groovy exppcitly. If it is installed, that is ignored by Gradle.

The steps to install Gradle in your system are explained below.

Step 1 − Verify JAVA Installation

First of all, you need to have Java Software Development Kit (SDK) installed on your system. To verify this, execute Java –version command in any of the platform you are working on.

In Windows

Execute the following command to verify Java installation. I have installed JDK 1.8 in my system.


C:> java - version

Output

The output is as follows −


java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b18, mixed mode)

In Linux

Execute the following command to verify Java installation.We have installed JDK 1.8 in the system.


$ java - version

Output


java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b18, mixed mode)

We assume the readers of this tutorial have Java SDK version 1.8.0_66 installed on their system.

Step 2 − Download Gradle Build File

Download the latest version of Gradle from the pnk available at https://gradle.org/install/. In the reference page, cpck on the Complete Distribution pnk. This step is common for any platform. For this you will get the complete distribution file into your Downloads folder.

Step 3 − Set Up Environment for Gradle

Setting up environment means, we have to extract the distribution file and copy the pbrary files into proper location. Set up GRADLE_HOME and PATH environmental variables. This step is platform dependent.

In Windows

Extract the downloaded zip file named gradle-2.11-all.zip and copy the distribution files from Downloadsgradle-2.11 to C:gradle location.

After that, add the C:gradle and C:gradlein directories to the GRADLE_HOME and PATH system variables.

Follow the given instructions − Right Cpck On My Computers -> Cpck On Properties -> Advanced System Settings -> Cpck On Environmental Variables.

There you will find a dialog box for creating and editing system variables.

Cpck on new button for creating GRADLE_HOME variable (follow the left side screenshot).

Cpck on Edit for editing the existing Path system variable (follow the right side screenshot).

Follow the below given screenshots.

Setup Environment for Gradle

In Linux

Extract the downloaded zip file named gradle-2.11-all.zip then you will find an extracted file named gradle-2.11.

You can use the following to move the distribution files from Downloads/gradle-2.11/ to /opt/gradle/ location. Execute this operation from the Downloads directory.


$ sudo mv gradle-2.11 /opt/gradle

Edit the ~/.bashrc file and paste the following content to it and save it.


export ORIENT_HOME = /opt/gradle
export PATH = $PATH:

Execute the following command to execute ~/.bashrc file.


$ source ~/.bashrc

Step 4 − Verify the Gradle installation

In windows

You can execute the following command in command prompt.


C:> gradle –v

Output

Here you will find the Gradle version.


------------------------------------------------------------
Gradle 2.11
------------------------------------------------------------

Build time: 2016-02-08 07:59:16 UTC
Build number: none
Revision: 584db1c7c90bdd1de1d1c4c51271c665bfcba978
Groovy: 2.4.4

Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM: 1.7.0_60 (Oracle Corporation 24.60-b09)
OS: Windows 8.1 6.3 amd64

In Linux

You can execute the following command in terminal.


$ gradle –v

Output

Here you will find the Gradle version.


------------------------------------------------------------
Gradle 2.11
------------------------------------------------------------

Build time: 2016-02-08 07:59:16 UTC
Build number: none
Revision: 584db1c7c90bdd1de1d1c4c51271c665bfcba978

Groovy: 2.4.4
Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM: 1.7.0_60 (Oracle Corporation 24.60-b09)
OS: Windows 8.1 6.3 amd64 

In Linux

You can execute the following command in terminal.


$ gradle –v

Output

You will find the Gradle version.


------------------------------------------------------------
Gradle 2.11
------------------------------------------------------------
Build time: 2016-02-08 07:59:16 UTC
Build number: none
Revision: 584db1c7c90bdd1de1d1c4c51271c665bfcba978
Groovy: 2.4.4
Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM: 1.7.0_60 (Oracle Corporation 24.60-b09)
OS: Linux 3.13.0-74-generic amd64
Advertisements