{"id":3334,"date":"2019-06-19T12:00:13","date_gmt":"2019-06-19T09:00:13","guid":{"rendered":"https:\/\/kifarunix.com\/?p=3334"},"modified":"2024-03-11T23:07:53","modified_gmt":"2024-03-11T20:07:53","slug":"install-gradle-on-debian-10-9","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-gradle-on-debian-10-9\/","title":{"rendered":"Install Gradle on Debian 10\/9"},"content":{"rendered":"\n
In this guide, we are going to learn how to install Gradle on Debian 10\/9. Gradle<\/a> is an open-source build automation tool for building (but not limited) Java-based projects. Gradle build scripts are written using a Groovy<\/a> or Kotlin<\/a> domain-specific language (DSL) instead of the XML form commonly used by Apache Maven for declaring the project configuration.<\/p>\n\n\n\n There are two ways in which Gradle can be installed; Automatically via the package manager and manually using Gradle binary. This guide discusses both ways.<\/p>\n\n\n\n Gradle runs on the JVM and thus as a prerequisite, you have to install OpenJDK or JRE 8 or later. Hence, update you system and install JDK.<\/p>\n\n\n\n We have covered the installation of various versions of Java in our previous guides. See the links below.<\/p>\n\n\n\n Install Oracle Java 12 on Debian 10<\/a><\/p>\n\n\n\n How to Manually Install Oracle Java 12 on Debian 10\/9\/Ubuntu 18.04<\/a><\/p>\n\n\n\n Install Oracle Java 12 on Ubuntu 18.04\/Debian 10\/9<\/a><\/p>\n\n\n\n Install Java 11 on Debian 10\/9\/Ubuntu 18.04<\/a><\/p>\n\n\n\n To install Gradle via package manager, you need to first install SDKMAN!<\/a>, a tool for managing parallel versions of multiple Software Development Kits on most Unix-like systems.<\/p>\n\n\n\n To install SDKMAN!, run the commands below;<\/p>\n\n\n\n SDKMAN! is installed on your home directory. Hence, once the installation is done, run the command below source the SDKMAN! init script.<\/p>\n\n\n\n To verify SDKMAN! installation;<\/p>\n\n\n\n You can now install Gradle using SDKMAN! by running the command;<\/p>\n\n\n\n You can also specify the version to install e.g;<\/p>\n\n\n\n Replace VERSION<\/strong> with the version number of Gradle to install. To list the available versions, run the command below;<\/p>\n\n\n\n Once the installation of Gradle completes, the installed version is displayed. You can as well check the version as shown below;<\/p>\n\n\n\n To manually install Gradle using the binary, navigate to Grade releases page<\/a> and grab the latest release binary<\/a>. As of this writing, it is version 7.1.1. You can simply download the binary with wget<\/strong> command as follows.<\/p>\n\n\n\n Once the installation is done, extract the binary to install directory. This demo uses \/opt\/<\/strong> directory.<\/p>\n\n\n\n The Gradle 7.1.1 contents are extracted to \/opt\/gradle-7.1.1<\/strong>.<\/p>\n\n\n\n Next, you need to create global Gradle home environment variable, GRADLE_HOME. You also need to add the Gradle bin<\/strong> directory to your PATH. These configs can be defined under the \/etc\/profile.d\/<\/strong> as a script.<\/p>\n\n\n\n Next, add the execute permissions to the script.<\/p>\n\n\n\n Once that is done, source the script to load the Gradle environment variables set.<\/p>\n\n\n\n Next, verify the version of Gradle installed.<\/p>\n\n\n\n Well, you have successfully installed Gradle and that is all on how to install Gradle on Debian.<\/p>\n\n\n\n Reference:<\/p>\n\n\n\n Getting started with Gradle<\/a><\/p>\n\n\n\n Other Tutorials<\/p>\n\n\n\nInstalling Gradle on Debian 10\/9<\/h2>\n\n\n\n
Prerequisites<\/h2>\n\n\n\n
Run system update<\/h3>\n\n\n\n
apt update\napt upgrade<\/code><\/pre>\n\n\n\n
Install Java on Debian 10\/9<\/h3>\n\n\n\n
Installing Gradle on Debian Package Manager<\/h2>\n\n\n\n
Install SDKMAN! on Debian 10\/9<\/h3>\n\n\n\n
apt install zip curl<\/code><\/pre>\n\n\n\n
curl -s \"https:\/\/get.sdkman.io\" | bash<\/code><\/pre>\n\n\n\n
source \"$HOME\/.sdkman\/bin\/sdkman-init.sh\"<\/code><\/pre>\n\n\n\n
sdk version<\/code><\/pre>\n\n\n\n
...\nSDKMAN 5.12.1<\/code><\/pre>\n\n\n\n
Install Gradle on Debian<\/h3>\n\n\n\n
sdk install gradle<\/code><\/pre>\n\n\n\n
sdk install gradle VERSION<\/code><\/pre>\n\n\n\n
sdk list gradle<\/code><\/pre>\n\n\n\n
gradle -v<\/code><\/pre>\n\n\n\n
\nWelcome to Gradle 7.1.1!\n\nHere are the highlights of this release:\n - Faster incremental Java compilation\n - Easier source set configuration in the Kotlin DSL\n\nFor more details see https:\/\/docs.gradle.org\/7.1.1\/release-notes.html\n\n\n------------------------------------------------------------\nGradle 7.1.1\n------------------------------------------------------------\n\nBuild time: 2021-07-02 12:16:43 UTC\nRevision: 774525a055494e0ece39f522ac7ad17498ce032c\n\nKotlin: 1.4.31\nGroovy: 3.0.7\nAnt: Apache Ant(TM) version 1.10.9 compiled on September 27 2020\nJVM: 11.0.11 (Debian 11.0.11+9-post-Debian-1deb10u1)\nOS: Linux 4.19.0-17-amd64 amd64\n<\/code><\/pre>\n\n\n\n
Installing Gradle Manually via the Gradle Binary<\/h3>\n\n\n\n
Download Gradle Binary<\/h4>\n\n\n\n
wget https:\/\/downloads.gradle.org\/distributions\/gradle-7.1.1-bin.zip<\/code><\/pre>\n\n\n\n
Extract the Binary<\/h4>\n\n\n\n
unzip gradle-7.1.1-bin.zip -d \/opt\/<\/code><\/pre>\n\n\n\n
ls \/opt\/gradle-7.1.1<\/code><\/pre>\n\n\n\n
bin init.d lib LICENSE NOTICE README<\/code><\/pre>\n\n\n\n
Configure Gradle Environment Variables<\/h4>\n\n\n\n
cat > \/etc\/profile.d\/gradle.sh << 'EOL'\nexport GRADLE_HOME=\/opt\/gradle-7.1.1\nexport PATH=${GRADLE_HOME}\/bin:${PATH}\nEOL<\/code><\/pre>\n\n\n\n
chmod +x \/etc\/profile.d\/gradle.sh<\/code><\/pre>\n\n\n\n
source \/etc\/profile.d\/gradle.sh<\/code><\/pre>\n\n\n\n
gradle -v<\/code><\/pre>\n\n\n\n
\n------------------------------------------------------------\nGradle 7.1.1\n------------------------------------------------------------\n\nBuild time: 2021-07-02 12:16:43 UTC\nRevision: 774525a055494e0ece39f522ac7ad17498ce032c\n\nKotlin: 1.4.31\nGroovy: 3.0.7\nAnt: Apache Ant(TM) version 1.10.9 compiled on September 27 2020\nJVM: 11.0.11 (Debian 11.0.11+9-post-Debian-1deb10u1)\nOS: Linux 4.19.0-17-amd64 amd64\n<\/code><\/pre>\n\n\n\n