How to Install Gradle on Ubuntu 20.04
Gradle is a universally useful device used to manufacture, mechanize, and convey programming. It is principally utilized for Java, C++, and Swift tasks.
Gradle consolidates the best highlights of Ant and Maven . In contrast to its archetypes, which use XML for scripting, Gradle utilizes Groovy , a dynamic, object-situated programming language for the Java stage to characterize the task and construct contents.
This guide discloses how to introduce Gradle on Ubuntu 20.04. We'll download the most recent arrival of Gradle from their official site.
Prerequisites
The directions accept that you are signed in as root or client with sudo benefits .
Installing OpenJDK
Gradle requires Java SE 8 or later to be introduced on the machine.
Enter the accompanying orders to introduce OpenJDK 11 :
sudo apt update
sudo apt install openjdk-11-jdk
Confirm the Java establishment by printing the Java adaptation :
java -version
The yield should look something like this:
openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-3ubuntu1)
OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-3ubuntu1, mixed mode, sharing)
Downloading Gradle
At the hour of composing this article, the most recent variant of Gradle is 6.5.1. Prior to proceeding with the subsequent stage, check the Gradle discharges page to check whether a fresher rendition is accessible.
Downloading the Gradle twofold just compress record in the/tmp catalog utilizing the accompanying wget order:
VERSION=6.5.1
wget https://services.gradle.org/distributions/gradle-${VERSION}-bin.zip
Once the download is finished, unfasten the record in the/select/gradle registry:
sudo unzip -d /opt/gradle /tmp/gradle-${VERSION}-bin.zip
On the off chance that you get a blunder saying "sudo: unfasten: order not found", introduce the unfasten bundle with sudo able introduce unfasten.
Gradle is routinely refreshed with security patches and new highlights. To have more command over variants and updates, we'll make a representative connection named most recent, which focuses to the Gradle establishment registry:
sudo ln -s /opt/gradle/gradle-${VERSION} /opt/gradle/latest
Afterward, while updating Gradle, unload the more current form and change the symlink to highlight it.
Setting up the Environment Variables
We have to add the Gradle container index to the framework PATH condition variable. To do as such, open your content manager and make another document named gradle.sh within the/and so forth/profile.d/registry.
sudo nano /etc/profile.d/gradle.sh
Glue the accompanying setup:
/etc/profile.d/gradle.sh
export GRADLE_HOME=/opt/gradle/latest
export PATH=${GRADLE_HOME}/bin:${PATH}
Spare and close the record. This content will be sourced at shell startup.
Make the content executable :
sudo chmod +x /etc/profile.d/gradle.sh
Burden the earth factors in the current shell meeting utilizing the source order:
source /etc/profile.d/gradle.sh
Confirming the Gradle Installation
To approve that Gradle is introduced appropriately utilize the gradle - v order which will show the Gradle form:
gradle -v
You should see something like the accompanying:
Welcome to Gradle 6.5.1!
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.1/release-notes.html
------------------------------------------------------------
Gradle 6.5.1
------------------------------------------------------------
Build time: 2020-06-30 06:32:47 UTC
Revision: 66bc713f7169626a7f0134bf452abde51550ea0a
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-26-generic amd64
That is it. You have introduced the most recent form of Gradle on your Ubuntu framework, and you can begin utilizing it.
Conclusion
We've told you the best way to introduce Gradle on Ubuntu 20.04. You would now be able to visit the authority Gradle Documentation page and figure out how to begin with Gradle.
On the off chance that you hit an issue or have criticism, leave a remark beneath.