How to Install Gradle on Debian 10

Table of Contents
Install Gradle on Debian
Gradle is a free and opensource general-purpose build tool used mainly for Java projects. It uses Groovy which is dynamic, object-oriented programming language to define projects and build scripts for Java language. Gradle is also used for building Android projects in Android Studio. In this tutorial, you are going to learn how to install Gradle on Debian 10.
Prerequisites
Before you start to install Gradle on Debian 10. You must have the non-root user account on your server/desktop with sudo privileges.
Install OpenJDK
First update apt
package manager index in Debian typing following command:
sudo apt update
Gradle requires Java to be installed on your system. To install OpenJDK 8 run following command in terminal:
sudo apt install openjdk-8-jdk
Confirm the OpenJDK installation typing following command:
java -version
Download Gradle
You can download Gradle from the official Gradle release page. The latest Gradle version available is 5.1
. You can check to visit their website if the new version is available.
To download Gradle 5.1 using wget
run following command:
wget https://services.gradle.org/distributions/gradle-5.1-bin.zip -P /tmp
Now unzip a downloaded zip file using the following command:
sudo unzip -d /opt/gradle /tmp/gradle-5.1.zip
Setup Environment Variables
PATH Environment variable should include the Gradle directory. So we should create gradle.sh
file inside /etc/profile.d/
directory. To create file run following command:
sudo nano /etc/profile.d/gradle.sh
Now paste the following code inside the above file.
export GRADLE_HOME=/opt/gradle/gradle-5.1 export PATH=${GRADLE_HOME}/bin:${PATH}
Save the file and close the file.
Now make the script file executable using the following command:
sudo chmod +x /etc/profile.d/gradle.sh
Load the environment variables using the following command:
source /etc/profile.d/gradle.sh
Verify Installation
Now verify the installation of Gradle using the following command.
gradle -v
And the output should look like:
Welcome to Gradle 5.1! Here are the highlights of this release: - Kotlin DSL 1.0 - Task timeouts - Dependency alignment aka BOM support - Interactive `gradle init` For more details see https://docs.gradle.org/5.1/release-notes.html ------------------------------------------------------------ Gradle 5.1 ------------------------------------------------------------ Build time: 2018-12-29 11:48:43 UTC Revision: e0824aec8a0f5462fc5fd9872664dbc7fc6e5abf Kotlin DSL: 1.0.4 Kotlin: 1.3.10 Groovy: 2.5.4 Ant: Apache Ant(TM) version 1.9.13 compiled on January 5 2019 JVM: 1.8.0_181 (Oracle Corporation 25.181-b13) OS: Linux 4.15.0-36-generic amd64
Conclusion
You have successfully learned how to install Gradle on Debian 10. If you have any queries regarding this please don’t forget to comment below.
LATEST POSTS
-
How to Install IntelliJ IDEA IDE on Fedora 29
-
How to Add Swap Space on Debian 9
-
How to Install R on Linux Mint 19
-
How to install Laravel PHP Framework With Nginx on Ubuntu 18.04
-
How to install Dropbox on CentOS 7 Server
-
How to Install Skype on CentOS 7
-
How to Install Laravel PHP Framework With Nginx on CentOS 8
-
How to install Krita on Debian 9
-
How to Change Hostname on Ubuntu 18.04
-
How to Install Eclipse IDE on Linux Mint 19
-
How to Install RubyMine on Linux Mint 19
-
How to Install Mozilla Firefox on Linux Mint 19