Gradle is an open-source build automation tool focused on flexibility and performances. It builds upon the concepts of Apache Ant and Apache Maven. It introduces a Groovy-based domain-specific language (DSL) instead of the XML form used by Apache Maven for declaring the project configuration.

Gradle was designed for multi-project builds, which can grow to be quite large. It supports incremental builds by intelligently determining which parts of the build tree are up to date; any task dependent only on those parts does not need to be re-executed. Below are some of the best features of Gradle:

  • Highly customizable — Gradle is modelled in a way that customizable and extensible in the most fundamental ways.

  • Fast — Gradle completes tasks quickly by reusing outputs from previous executions, processing only inputs that changed, and executing tasks in parallel.

  • Powerful — Gradle is the official build tool for Android, and comes with support for many popular languages and technologies.

To install Gradle on CentOS 7, you can follow the guide here

To install Gradle on Ubuntu 16, you can follow the guide here

In this guide, we will explain how to install Gradle on a Debian 9 server.

Deploying your cloud server
If you have not already registered with Cloudwafer, you should begin by getting signed up. Take a moment to create an account after which you can quickly deploy your cloud servers.

Once you have signed up, log into your Cloudwafer Client Area and deploy your Cloudwafer cloud server.

Updating System Packages

It is recommended that you update the system to the latest packages before beginning any major installations. Issue the command below:

sudo apt-get update && sudo apt-get upgrade

Prerequisites: Gradle requires a Java JDK version 7 or higher to run. You can check here on how to install Java on Debian 9 if you don't have it installed. To check the version of Java that is currently set as the default, issue the command below:

java -version

Step 1: Download and install Gradle
As at the time of writing this guide, the current Gradle release is version v6.0.1 released on Nov 18, 2019. The distribution zip file comes in two flavours: Binary-only and Complete (all with docs and sources). We are going to download and install the Binary-only flavour for this guide.

wget https://downloads.gradle-dn.com/distributions/gradle-6.0.1-bin.zip

Step 2: Unpack the distribution

  • Create a directory for the Gradle installation

    sudo mkdir /opt/gradle
    
  • Extract the downloaded archive to the newly-created directory.

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

  • You can view the contents of the directory using the command below:

    ls /opt/gradle/gradle-6.0.1
    

Step 3: Configure your system environment
For running Gradle, we'll need to configure the PATH environment variable to include the Gradle bin directory.

Create a new file named gradle.sh inside of the /etc/profile.d/ directory.

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

Enter the following:

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

Ensure to save the file before you close.

Next, make the script executable by issuing the following command:

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

Next, load the environment variables using the command below:

source /etc/profile.d/gradle.sh

Step 4: Verifying installation
Issue the command below to run Gradle and display the version

gradle -v

You have completed the Gradle installation.
You can check the official Gradle Documentation to learn more on Gradle.