You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

Welcome to our guide on How to install Gradle on Ubuntu 20.04 / Ubuntu 18.04 / Debian 10. Gradle is an open-source build automation tool that is focused on performance, speed and flexibility. Gradle build scripts are written using a Groovy or Kotlin domain-specific language.

Gradle has been designed to be highly customizable and extensible. It is able to achieve higher speeds by executing tasks in parallel, re-using results from previous executions and processing only inputs that changed.

Install Gradle on Ubuntu 18.04 / Debian 10 Linux

This guide will take your through all the steps to install the latest release of Gradle on Ubuntu 18.04 / Debian 10.

Step 1: Install Pre-requisites

Gradle requires Java JRE or OpenJDK to function. If you don’t have Java installed, use the commands below to install it.

sudo apt update
sudo apt install -y default-jdk

Check if your Java has been installed by querying for the version:

$ java --version
openjdk version "11.0.5" 2019-10-15
OpenJDK Runtime Environment (build 11.0.5+10-post-Ubuntu-0ubuntu1.118.04)
OpenJDK 64-Bit Server VM (build 11.0.5+10-post-Ubuntu-0ubuntu1.118.04, mixed mode, sharing))

Step 2: Download and Install Gradle

Once you have Java installed, the next step is to download and install Gradle. The latest release of Gradle can be checked from the link.

Install Gradle on Ubuntu 20.04 / 18.04 from PPA Repository

We will use a PPA repository to install Gradle on Ubuntu 18.04/16.04 for easy updates and management.

Add PPA repository to your system by running the following commands:

sudo apt -y install vim apt-transport-https dirmngr wget software-properties-common
sudo add-apt-repository ppa:cwchien/gradle

Update system and install Gradle

sudo apt-get update
sudo apt -y install gradle

Confirm installed version of Gradle:

$ gradle -v

Welcome to Gradle 6.0.1!

Here are the highlights of this release:
 - Substantial improvements in dependency management, including
   - Publishing Gradle Module Metadata in addition to pom.xml
   - Advanced control of transitive versions
   - Support for optional features and dependencies
   - Rules to tweak published metadata
 - Support for Java 13
 - Faster incremental Java and Groovy compilation
 - New Zinc compiler for Scala
 - VS2019 support
 - Support for Gradle Enterprise plugin 3.0

For more details see https://docs.gradle.org/6.0.1/release-notes.html


------------------------------------------------------------
Gradle 6.0.1
------------------------------------------------------------

Build time:   2019-11-18 20:25:01 UTC
Revision:     fad121066a68c4701acd362daf4287a7c309a0f5

Kotlin:       1.3.50
Groovy:       2.5.8
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          11.0.5 (Private Build 11.0.5+10-post-Ubuntu-0ubuntu1.118.04)
OS:           Linux 4.15.0-58-generic amd64

Install Gradle on Debian 10 / 9 from PPA Repository

For Debian 9, install the following packages:

sudo apt update
sudo apt -y install gnupg2
sudo apt -y install vim apt-transport-https dirmngr wget software-properties-common

Then import GPG key:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D7CC6F019D06AF36

You should receive output similar to below

Executing: /tmp/apt-key-gpghome.eGRTsZJki3/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys D7CC6F019D06AF36
gpg: key D7CC6F019D06AF36: public key "Launchpad PPA for Cheng-Wei Chien" imported
gpg: Total number processed: 1
gpg:               imported: 1

Once key is imported, add PPA repository

sudo add-apt-repository ppa:cwchien/gradle

Update your Debian 9 package list

$ sudo apt update
Hit:1 http://deb.debian.org/debian stretch-backports InRelease
Ign:4 http://download.webmin.com/download/repository sarge InRelease                                                                                  
Get:2 http://ppa.launchpad.net/cwchien/gradle/ubuntu disco InRelease [15.4 kB]
Hit:5 http://download.webmin.com/download/repository sarge Release                      
Get:6 http://ppa.launchpad.net/cwchien/gradle/ubuntu disco/main amd64 Packages [740 B]  
Ign:3 http://cdn-fastly.deb.debian.org/debian stretch InRelease                               
Hit:8 http://cdn-fastly.deb.debian.org/debian stretch Release
Fetched 16.1 kB in 3s (4351 B/s)
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.

Finally install Gradle by running:

sudo apt install gradle

Verify the version of Gradle installed on your Ubuntu 18.04 / Ubuntu 16.04 & Debian 9 system.

$ gradle --version

------------------------------------------------------------
Gradle 5.0
------------------------------------------------------------

Build time:   2018-11-26 11:48:43 UTC
Revision:     7fc6e5abf2fc5fe0824aec8a0f5462664dbcd987

Kotlin DSL:   1.0.4
Kotlin:       1.3.10
Groovy:       2.5.4
Ant:          Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM:          11.0.1 (Oracle Corporation 11.0.1+13)
OS:           Linux 4.9.0-8-amd64 amd64

You have successfully installed Gradle on Ubuntu 18.04 / Debian 9 / Ubuntu 16.04 from PPA repository. Kudos!.

You can support us by downloading this article as PDF from the Link below. Download the guide as PDF