Gradle is an open-source build automation tool; Java projects mostly uses Gradle. It automates the building process of applications which includes compiling, linking, and packaging of code without manual input. Gradle also supports Groovy, which is an object-oriented dynamic language for Java applications. Gradle combines the best features of Ant and Maven. Unlike its predecessors, which use XML for scripting, Gradle uses Groovy , a dynamic, object-oriented programming language for the Java platform to define the project and build scripts. In this tutorial we will Install Gradle on Ubuntu.
Install Open JDK:
Gradle requires Open JDK. Install it using the following command:
apt update
apt upgrade
apt install openjdk-11-jdk
Verify the installation of Java using the following command:
java -version
Install Gradle on Ubuntu:
As of now gradle version is 7.4.2. Download the latest binary of gradle using the following command:
mkdir /opt/gradle
cd /opt/gradle
wget https://services.gradle.org/distributions/gradle-7.4.2-bin.zip
Unzip the file using the following command:
unzip gradle-7.4.2-bin.zip
Now that the installation of Gradle in complete. Please set the environment variables in a file using the following command:
nano /etc/profile.d/gradle.sh
Add the following lines in the file:
export GRADLE_HOME=/opt/gradle/latest
export PATH=${GRADLE_HOME}/bin:${PATH}
save and close the file.
Give the file executable rights using the following command:
chmod +x /etc/profile.d/gradle.sh
Load the environment variables using the following command;
source /etc/profile.d/gradle.sh
Verify the Gradle installation using the following command:
gradle -v
Gradle installation is complete now. You can use it according to your need.