Gradle is a general-purpose build tool used primarily for Java projects. It combines the best features of Ant and Maven. Gradle uses Groovy instead of using XML for scripting.
In this tutorial we will show you how to install the latest version of Gradle on Ubuntu 20.04 LTS.
Install Gradle on ubuntu 20
1. Download Gradle
– First, to download the latest version of Gradle, visit the Gradle releases page. Use the wget
command to download Gradle zip file in the /tmp
directory:
$ VERSION=6.5 $ wget https://services.gradle.org/distributions/gradle-${VERSION}-bin.zip -P /tmp
– Once the download is completed, extract the zip file in the /opt/gradle
directory:
$ sudo unzip -d /opt/ /tmp/gradle-*.zip $ sudo ln -s /opt/gradle-${VERSION} /opt/gradle
2. Setup environment variables
– To configure the PATH
environment variable to include the Gradle bin directory. create a new file named gradle.sh
inside the /etc/profile.d/
directory as below.
$ sudo vi /etc/profile.d/gradle.sh export GRADLE_HOME=/opt/gradle export PATH=${GRADLE_HOME}/bin:${PATH}
– Finally, load the environment variables using the following command:
$ source /etc/profile.d/gradle.sh
3. Verify the Gradle installation
– Finally, to verify if Gradle is installed properly use the gradle -v
command which will display the Gradle version:
$ gradle -v Welcome to Gradle 6.5! Here are the highlights of this release: - Experimental file-system watching - Improved version ordering - New samples For more details see https://docs.gradle.org/6.5/release-notes.html ------------------------------------------------------------ Gradle 6.5 ------------------------------------------------------------ Build time: 2020-06-02 20:46:21 UTC Revision: a27f41e4ae5e8a41ab9b19f8dd6d86d7b384dad4 Kotlin: 1.3.72 Groovy: 2.5.11 Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019 JVM: 11.0.7 (Ubuntu 11.0.7+10-post-Ubuntu-3ubuntu1) OS: Linux 5.4.0-33-generic amd64
Conclusion
You have successfully installed Gradle on your Ubuntu 20.04 LTS. You might want to check the following guides: