Welcome to our guide on How to install Gradle on Ubuntu / Debian Linux system. 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 / Debian Linux
This guide will take your through all the steps to install the latest release of Gradle on Ubuntu / Debian system. We shall consider two installation methods foe this.
Method 1: Install Gradle on Debian / Ubuntu using SDKMAN
SDKMAN! is a tool for managing parallel versions of multiple Software Development Kits on most Unix based systems. It provides a convenient Command Line Interface (CLI) and API for installing, switching, removing and listing Candidates. Formerly known as GVM the Groovy enVironment Manager, it was inspired by the very useful RVM and rbenv tools, used at large by the Ruby community.
Install SDKMAN on your system.
sudo apt update && sudo apt install zip unzip default-jdk -y
curl -s "https://get.sdkman.io" | bash
Source the script to start using sdk
command:
source "/root/.sdkman/bin/sdkman-init.sh"
Use sdk
to install the latest stable release of Gradle.
sdk install gradle
Validate this installation was successful by checking the version of Gradle on the system.
$ gradle -version
Welcome to Gradle 8.1.1!
Here are the highlights of this release:
- Stable configuration cache
- Experimental Kotlin DSL assignment syntax
- Building with Java 20
For more details see https://docs.gradle.org/8.1.1/release-notes.html
------------------------------------------------------------
Gradle 8.1.1
------------------------------------------------------------
Build time: 2023-04-21 12:31:26 UTC
Revision: 1cf537a851c635c364a4214885f8b9798051175b
Kotlin: 1.8.10
Groovy: 3.0.15
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 11.0.18 (Debian 11.0.18+10-post-Debian-1deb11u1)
OS: Linux 5.10.0-21-amd64 amd64
Method 2: Install Gradle on Ubuntu from PPA repo
The first method we shall consider is PPA apt repository. This is more fit for Ubuntu Linux system.
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 11.0.18 2023-01-17
OpenJDK Runtime Environment (build 11.0.18+10-post-Ubuntu-0ubuntu122.04)
OpenJDK 64-Bit Server VM (build 11.0.18+10-post-Ubuntu-0ubuntu122.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.
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 update && sudo apt -y install gradle
Confirm installed version of Gradle:
$ gradle -v
Welcome to Gradle 7.4.2!
Here are the highlights of this release:
- Aggregated test and JaCoCo reports
- Marking additional test source directories as tests in IntelliJ
- Support for Adoptium JDKs in Java toolchains
For more details see https://docs.gradle.org/7.4.2/release-notes.html
------------------------------------------------------------
Gradle 7.4.2
------------------------------------------------------------
Build time: 2022-03-31 15:25:29 UTC
Revision: 540473b8118064efcc264694cbcaa4b677f61041
Kotlin: 1.5.31
Groovy: 3.0.9
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 11.0.18 (Ubuntu 11.0.18+10-post-Ubuntu-0ubuntu122.04)
OS: Linux 5.15.0-70-generic amd64