How to install Gradle 3.4.1 on Linux Mint 18.3

To install Gradle 3.4.1 on Linux Mint 18.3

Gradle is a free and open source build automation toolset based on the concepts of Apache Ant and Apache Maven and it provides a platform to support the entire development lifecycle of a software project. It is really so simple to install Gradle 3.4.1 on Linux Mint 18.3 and tutorial covers the ground on the same process. 

 

Installing Gradle 3.4.1

First, make sure you need to update the system repository by making use of the following command. 

linuxhelp user # apt-get update
Get:1 http://archive.canonical.com/ubuntu xenial InRelease [11.5 kB]
Hit:2 http://archive.ubuntu.com/ubuntu xenial InRelease                                          
Ign:3 http://packages.linuxmint.com sylvia InRelease                                                              
Get:4 http://archive.canonical.com/ubuntu xenial/partner amd64 Packages [3,132 B]                                 
Hit:5 http://packages.linuxmint.com sylvia Release                                                               
Get:6 http://archive.canonical.com/ubuntu xenial/partner i386 Packages [3,124 B]               
Get:8 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]  
.
.
Get:24 http://archive.ubuntu.com/ubuntu xenial-updates/universe Translation-en [241 kB]                           
Get:25 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [16.2 kB]                        
Get:26 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse i386 Packages [15.3 kB]                         
Get:27 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [7,080 B]                        
Get:28 http://archive.ubuntu.com/ubuntu xenial-backports/universe i386 Packages [7,064 B]                         
Get:29 http://archive.ubuntu.com/ubuntu xenial-backports/universe Translation-en [3,812 B]                        
Fetched 5,314 kB in 24s (214 kB/s)                                                                                
Reading package lists... Done

 

Once it is done, you need to install JDK by running the following command. It is very essential for this installation process. 

linuxhelp user # apt-get -y install openjdk-8-jdk wget unzip
Reading package lists... Done
Building dependency tree       
Reading state information... Done
unzip is already the newest version (6.0-20ubuntu1).
wget is already the newest version (1.17.1-1ubuntu1.3).
The following additional packages will be installed:
  ca-certificates-java libatk-wrapper-java libatk-wrapper-java-jni openjdk-9-jdk-headless openjdk-9-jre
  openjdk-9-jre-headless
Suggested packages:
  openjdk-9-demo openjdk-9-source visualvm icedtea-8-plugin fonts-ipafont-gothic fonts-ipafont-mincho
Recommended packages:
  libxt-dev libgnome-2-0
The following NEW packages will be installed:
.
.
                                  Processing triggers for ca-certificates (20170717~16.04.1) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed  done.
Running hooks in /etc/ca-certificates/update.d...
done.
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Processing triggers for desktop-file-utils (0.22+linuxmint1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.15-0ubuntu1) ...
Errors were encountered while processing:
 /var/cache/apt/archives/openjdk-9-jdk_9~b114-0ubuntu1_amd64.deb

 

After it is installed you can check java version which you have just installed. You can also confirm your installation through this command. 

linuxhelp user # java -version
openjdk version " 9-internal" 
OpenJDK Runtime Environment (build 9-internal+0-2016-04-14-195246.buildd.src)
OpenJDK 64-Bit Server VM (build 9-internal+0-2016-04-14-195246.buildd.src, mixed mode)

 

Once it is done, you shall download   the Gradle directory. 

linuxhelp user # wget https://services.gradle.org/distributions/gradle-3.4.1-bin.zip
--2018-03-15 00:24:42--  https://services.gradle.org/distributions/gradle-3.4.1-bin.zip
Resolving services.gradle.org (services.gradle.org)... 104.16.175.166, 104.16.172.166, 104.16.171.166, ...
Connecting to services.gradle.org (services.gradle.org)|104.16.175.166|:443... connected.
.
.
HTTP request sent, awaiting response... 200 OK
Length: 70310446 (67M) [application/zip]
Saving to: ‘ gradle-3.4.1-bin.zip’ 

gradle-3.4.1-bin.zip         100%[=============================================> ]  67.05M  1.12MB/s    in 61s     

2018-03-15 00:25:44 (1.10 MB/s) - ‘ gradle-3.4.1-bin.zip’  saved [70310446/70310446]

 

After that you shall make directory for gradle. 

linuxhelp user # mkdir /opt/gradle

 

And unzip the downloaded package

linuxhelp user # unzip -d /opt/gradle/ gradle-3.4.1-bin.zip 
Archive:  gradle-3.4.1-bin.zip
   creating: /opt/gradle/gradle-3.4.1/
  inflating: /opt/gradle/gradle-3.4.1/LICENSE  
   creating: /opt/gradle/gradle-3.4.1/media/
  inflating: /opt/gradle/gradle-3.4.1/media/gradle-icon-16x16.png  
  inflating: /opt/gradle/gradle-3.4.1/media/gradle-icon-24x24.png  
  inflating: /opt/gradle/gradle-3.4.1/media/gradle.icns  
.
.
  inflating: /opt/gradle/gradle-3.4.1/lib/plugins/jcifs-1.3.17.jar  
  inflating: /opt/gradle/gradle-3.4.1/lib/plugins/xercesImpl-2.9.1.jar  
  inflating: /opt/gradle/gradle-3.4.1/lib/plugins/xml-apis-1.3.04.jar  
  inflating: /opt/gradle/gradle-3.4.1/lib/plugins/plexus-component-annotations-1.5.5.jar  
  inflating: /opt/gradle/gradle-3.4.1/lib/plugins/hamcrest-core-1.3.jar  
  inflating: /opt/gradle/gradle-3.4.1/lib/gradle-version-info-3.4.1.jar  

 

And then, set an environment variable for Gradle with the help of the following command. 

linuxhelp bin # export PATH=$PATH:/opt/gradle/gradle-3.4.1/bin

 

Also, you can get to know more information on Gradle by running the following command. 

linuxhelp bin # gradle -v
------------------------------------------------------------
Gradle 3.4.1
------------------------------------------------------------
Build time:   2017-03-03 19:45:41 UTC
Revision:     9eb76efdd3d034dc506c719dac2955efb5ff9a93

Groovy:       2.4.7
Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM:          9-internal (Oracle Corporation 9-internal+0-2016-04-14-195246.buildd.src)
OS:           Linux 4.10.0-38-generic amd64

 

You can start the Gradle daemon by making use of the following command. 

linuxhelp bin # gradle
Starting a Gradle Daemon (subsequent builds will be faster)
:help
Welcome to Gradle 3.4.1.
To run a build, run gradle < task>  ...
To see a list of available tasks, run gradle tasks
To see a list of command-line options, run gradle --help
To see more detail about a task, run gradle help --task < task> 
BUILD SUCCESSFUL
Total time: 18.443 secs


With this, the method to isntall Gradle comes to an end. 

FAQ
Q
Where to get latest releases of gradle?
A
Please refer the link as follow "https://services.gradle.org/distributions/"
Q
Why we use Gradle?
A
Gradle is a free and open source automation toolset based on Apache Ant and Apache Maven
Q
Mention the usage of Gradle?
A
open source automation toolset based on Apache Ant and Apache Maven. Gradle is also used for building, testing, publishing, deployment for generating static websites, documentations, etc.
Q
What version of Java is recommended for Gradle?
A
java-1.8.0-openjdk is required for Gradle.
Q
is Gradle available for multiple Platform?
A
yes , Gradle is a cross platform application.