Set up Gradle on Ubuntu 22.04: Quick and Efficient Steps

This tutorial on the Orcacore website intends to teach you to Set up Gradle on Ubuntu 22.04. Gradle is a build automation tool often used for JVM languages such as Java, Groovy, or Scala. Gradle can be configured to run Tasks that do things like compile jars, run tests, create documentation, and much more.

You may be wondering if you need Gradle or a similar build system. Simply put: Whenever a project is slightly more complex than the canonical Hello World print, you need Gradle.

Steps To Set up Gradle on Ubuntu 22.04

To complete this guide, log in to your server as a non-root user with sudo privileges. To do this, follow our guide on the Initial Server Setup with Ubuntu 22.04.

Now follow the steps below to install the latest release of Gradle from their official website.

1. Install OpenJDK on Ubuntu 22.04

Gradle requires Java SE 8 or later to be installed on the machine.

First, update your local package index with the following command:

sudo apt update

Then, install OpenJDK on your server with the command below:

sudo apt install default-jre -y

Verify your Java installation by checking its version:

java -version
Verify Java version for Gradle Build Tool

2. Install Gradle on Ubuntu 22.04

At this point, you need to visit the Gradle Releases page and download the latest version on your Ubuntu 22.04 server.

Download the Gradle Build Tool

Use the following wget command to download the Gradle in the /tmp directory:

sudo wget https://downloads.gradle-dn.com/distributions/gradle-8.0.2-bin.zip -P /tmp

When your download is completed, extract your file in the /opt/gradle directory:

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

Set up Environment Variables

At this point, you need to configure the environmental variable PATH on Ubuntu 22.04. To do this, run the command below:

export PATH=$PATH:/opt/gradle/gradle-8.0.2/bin

Verify Gradle Installation

At this point, your Gradle installation is completed, you can verify it by checking its version on Ubuntu 22.04:

gradle -v
Verify Gradle Installation

That’s it. The installation has been completed successfully.

Conclusion

At this point, you have learned to Set up Gradle on Ubuntu 22.04. Gradle is designed to automate the process of building, testing, packaging, and deploying applications.

Hope you enjoy it. Please subscribe to us on Facebook and Twitter.

Also, you may like to read the following articles:

Apache Maven installation on Ubuntu 22.04

Install chkrootkit Ubuntu 22.04

Tesseract OCR Setup on Ubuntu 22.04

Install Anaconda Python Ubuntu 22.04

Nginx Let’s Encrypt Ubuntu 22.04

CSF Firewall Setup Ubuntu 22.04

Share your love

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!