Gradle Installation
Gradle is a free and open-source build tool for automating application development. Gradle makes it easy and faster for developers to build, automate, and deliver software. This tutorial will walk you through Gradle Installation on Ubuntu 18.04 / Ubuntu 16.04.
Table of Contents
Requirements
Gradle requires Java JDK 8 or JRE 8 or a later version of Java. Ensure the java is installed on your Ubuntu system, or use the following command to do so.
sudo apt install openjdk-11-jdk
Verify the Java version on your system.
java -version
openjdk 11.0.6 2020-01-14
OpenJDK Runtime Environment (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1)
OpenJDK 64-Bit Server VM (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1, mixed mode, sharing)
How To Install Gradle on Ubuntu?
Once you have installed Java on your computer, you are ready to go. From its official download page, get the new Gradle distribution release binary file.
wget https://downloads.gradle-dn.com/distributions/gradle-6.3-bin.zip
Then, after downloading the folder, extract it and save it to the appropriate location. In general, I kept my applications in the /usr/local directory. You may use a different directory, such as /opt.
unzip gradle-6.3-bin.zip
mv gradle-6.3 /usr/local/gradle
Setup Gradle with PATH Environment Variable
Now you must configure Gradle to use the PATH environment variable, as well as ensure that the variable is set after the system is rebooted.
To set the PATH variable on reboot, place a shell script in the profile.d directory. Create a file that looks like this:
vim /etc/profile.d/gradle.sh
and add the line below to the file
export PATH=/usr/local/gradle/bin:$PATH
Save and close the file. Now you can use the script to apply the current shell’s setting.
source /etc/profile.d/gradle.sh
And you have successfully installed Grandle on your Ubuntu system.
Verify Gradle Version
Verify the version of Gradle that is installed on your system now that you have finished installing it.
gradle -v
Result
Welcome to Gradle 6.3!
Here are the highlights of this release:
- Java 14 support
- Improved error messages for unexpected failures
For more details see https://docs.gradle.org/6.3/release-notes.html
------------------------------------------------------------
Gradle 6.3
------------------------------------------------------------
Build time: 2020-03-24 19:52:07 UTC
Revision: bacd40b727b0130eeac8855ae3f9fd9a0b207c60
Kotlin: 1.3.70
Groovy: 2.5.10
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 14 (Oracle Corporation 14+36-1461)
OS: Linux 4.15.0-66-generic amd64
Gradle has been successfully installed and configured on your Ubuntu system if you see the above results.
Saad Shafqat
Related posts
New Articles
Getting Around: 9 Top Keyboard Shortcuts for Mac
As easy to use as Macs are, there’s always room for improvement in the user-friendly department. Case in point: Mac…