Steps To Install Gradle Build Automation Tool on Debian 12

In this guide, you will learn the Steps To Install Gradle Build Automation Tool on Debian 12 Bookworm. Gradle is a build automation tool that is used for JVM languages such as Java, Groovy, or Scala. Also, it can be configured to run Tasks that do things like compile jars, run tests, create documentation, and much more.

Steps To Install Gradle Build Automation Tool on Debian 12

To complete this guide, you must have access to your server as a non-root user with sudo privileges. For this purpose, you can follow this guide on Initial Server Setup with Debian 12 Bookworm.

Also, you must have OpenJDK installed on your server. To do this, you can visit How To Install Java with APT on Debian 12.

Now follow the steps below to start your Gradle installation.

Step 1 – Install Gradle from Source on Debian 12

At this point, you need to visit the Gradle Downloads page and check for the latest release of the Gradle.

Download the Gradle with the following wget command on your server:

sudo wget https://downloads.gradle.org/distributions/gradle-8.2.1-bin.zip

Then, make a directory for your Gradle in the opt directory on Debian 12:

sudo mkdir /opt/gradle

Next, unzip your downloaded file in the Gradle directory:

unzip -d /opt/gradle gradle-8.2.1-bin.zip

To have more control over versions and updates, you can create a symbolic link named latest, which points to the Gradle installation directory:

sudo ln -s /opt/gradle/gradle-8.2.1  /opt/gradle/latest

Step 2 – Set up Gradle Environment Variables on Debian 12

At this point, you need to add the Gradle bin directory to the system PATH environment variable. To do this, create a new file with your favorite text editor inside of the /etc/profile.d/ directory:

sudo vi /etc/profile.d/gradle.sh

Add the following content to the file:

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

When you are done, save and close the file.

Now make your file executable:

sudo chmod +x /etc/profile.d/gradle.sh

Load the environment variables in the current shell session using the source command:

sudo source /etc/profile.d/gradle.sh

Step 3 – Verify Gradle Build Automation Tool Installation

At this point, you can verify your Gradle installation on Debian 12 by checking its version:

gradle -v
Output
Welcome to Gradle 8.2.1!

Here are the highlights of this release:
 - Kotlin DSL: new reference documentation, assignment syntax by default
 - Kotlin DSL is now the default with Gradle init
 - Improved suggestions to resolve errors in console output
 - Reduced sync memory consumption

For more details see https://docs.gradle.org/8.2.1/release-notes.html


------------------------------------------------------------
Gradle 8.2.1
------------------------------------------------------------

Build time:   2023-07-10 12:12:35 UTC
Revision:     a38ec64d3c4612da9083cc506a1ccb212afeecaa

Kotlin:       1.8.20
Groovy:       3.0.17
Ant:          Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM:          17.0.7 (Debian 17.0.7+7-Debian-1deb12u1)
OS:           Linux 6.1.0-10-amd64 amd64

That’s it. You have installed the latest version of Gradle on your system, and you can start using it.

Conclusion

At this point, you have learned the Steps To Install the Gradle Build Automation Tool on Debian 12 from the source in the latest version. Hope you enjoy using it. Please subscribe to us on Facebook, Instagram, and Twitter.

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!