How to Install Gradle on Debian 9

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 9.
Prerequisites
Before you start to install Gradle on Debian. 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 official Gradle release page. The latest Gradle version available is 5.1
. You can check visiting there website if 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 downloaded zip file using following command:
sudo unzip -d /opt/gradle /tmp/gradle-5.1.zip
Setup Environment Variables
PATH Environment variable should include 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 following code inside 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 script file executable using following command:
sudo chmod +x /etc/profile.d/gradle.sh
Load the environment variables using following command:
source /etc/profile.d/gradle.sh
Verify Installation
Now verify the installation of Gradle using 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 9. If you have any queries regarding this please don’t forget to comment below.
LATEST POSTS
-
How to Check CentOS Version
-
How to Install Arduino IDE on Ubuntu 18.04
-
How to Install Postman on Debian 9
-
How to Install Apache on Debian 9
-
How to Install Sublime Text 3 on Fedora 29
-
How to Install WordPress with LEMP Stack on Debian 10
-
How to Install DataGrip on Linux Mint 19
-
How to Install Postman on Manjaro 18
-
How to Install Eclipse IDE on Linux Mint 19
-
How to Install PhpStorm on Debian 10
-
How to Remove Docker Images, Networks, Containers and Volumes
-
How to Install Anaconda on Debian 9