How to Install Gradle Build Tool on Ubuntu 16.04 | 18.04 | 18.10

Gradle is an open-source build automation system that helps developers automate, build and deliver software efficiently… It improves on Apache Ant and Apache Maven concepts and uses Groovy style language instead of XML, unlike its predecessors…

Gradle also works with many of the popular IDE platforms available today, including, Android Studio, Eclipse, IDEA and NetBeans…

For more about Gradle, please visit its homepage..

This brief tutorial is going to show students and new users how to install Gradle Build Tool on Ubuntu 16.04 | 18.04 and 18.10 systems…To get starting installing Gradle on Ubuntu systems, follow the steps below:

Step 1: Install Java JDK

Gradle needs Java JDK installed on Ubuntu… It requires Java JDK 7 and above… however, Java JDK 8 is much more stable and supported across many platforms… For this tutorial, we’re going to be installing OpenJDK 8 on Ubuntu..

To install OpenJDK 8, run the commands below

sudo apt update
sudo apt install openjdk-8-jdk

After that, run the commands below to print out the version of Java installed….

java -version

You should see see similar content as shown below:

openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-0ubuntu0.18.04.1-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)

Step 2: Install Gradle

Now that OpenJDK 8 is installed, run the commands below to download Gradle version 4.10.2 in the /tmp… At the time of this writing, the version is 4.10.2

cd /tmp

After that, extract the content in to the /opt directory…

sudo unzip -d /opt/gradle /tmp/gradle-*.zip

Gradle should be extracted to the /opt/gradle/gradle-4.10.2 directory… You will want to keep the version separate so you can upgrade easily… In the future, all you need to do is create a symbolic link to the version folder to use that version…

Step 3: Configure Ubuntu Environment Variables

Now that you’ve extracted Gradle content, go and configure Ubuntu environment variables to use Gradle… You can do that by running the commands below to create a new file called in the /etc/profile.d directory…

sudo nano /etc/profile.d/

They copy and pastes the lines below into the file and save…

export GRADLE_HOME=/opt/gradle/gradle-4.10.2
export PATH=${GRADLE_HOME}/bin:${PATH}

When you’re done, run the commands below to make the file executable…

sudo chmod +x /etc/profile.d/
source /etc/profile.d/

That’s it!

You should be able to use Gradle on Ubuntu… To print out Gradle version and info sheet, run the commands below

gradle -v

That should print out its info as shown below:

Welcome to Gradle 4.10.2!

Here are the highlights of this release:
 - Incremental Java compilation by default
 - Periodic Gradle caches cleanup
 - Gradle Kotlin DSL 1.0-RC6
 - Nested included builds
 - SNAPSHOT plugin versions in the `plugins {}` block

For more details see

Gradle 4.10.2

Build time:   2018-09-19 18:10:15 UTC
Revision:     b4d8d5d170bb4ba516e88d7fe5647e2323d791dd

Kotlin DSL:   1.0-rc-6
Kotlin:       1.2.61
Groovy:       2.4.15
Ant:          Apache Ant(TM) version 1.9.11 compiled on March 23 2018
JVM:          1.8.0_181 (Oracle Corporation 25.181-b13)
OS:           Linux 4.15.0-36-generic amd64



You have learned how to successfully install Gradle Build Tool on Ubuntu 16.04 | 18.04 and 18.10 systems…

You may also like the post below:

Setup LibreNMS on Ubuntu 16.04 / 18.04 / 18.10 with Nginx, MariaDB and PHP 7.2-FPM

One Reply to “How to Install Gradle Build Tool on Ubuntu 16.04 | 18.04 | 18.10”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: