Gradle is an open-source build automation tool used for Java, Groovy and Scala development. It builds upon the concepts of Apache Ant and Apache Maven. Unlike Apache Maven which uses XML for declaring project configurations, Gradle uses Groovy, a dynamic, object-oriented programming language to define the project configurations.
In this post, we will install Gradle on Ubuntu 18.04 / Ubuntu 16.04, Linux Mint 19 & Debian 9.
OK, here we go...
$ cd /tmp
$ wget https://services.gradle.org/distributions/gradle-5.2.1-bin.zip
HTTP request sent, awaiting response... 200 OK
Length: 87430521 (83M) [application/zip]
Saving to: ‘gradle-5.2.1-bin.zip’
gradle-5.2.1-bin.zip 100%[================================================================>] 83.38M 12.5MB/s in 6.1s
2019-12-24 10:25:18 (13.6 MB/s) - ‘gradle-5.2.1-bin.zip’ saved [87430521/87430521]
$ ls /opt
google zoom
$ sudo mkdir /opt/gradle
[sudo] password for dpc:
$ ls /opt
google gradle zoom
$ pwd # Let's see WTF we've got...
$ ls
adb.1000.log mozilla-temp-1402788139 pymp-orr25t9f
apt-key-gpghome.UfzzH71shp mozilla-temp-243847897 pymp-qhqr6ysg
config-err-MJUj3M mozilla-temp-332564710 qtsingleapp-zoom-3e8
config-err-nIfWkb mysql-workbench-10517 qtsingleapp-zoom-3e8-lockfile
config-err-QFyTKO mysql-workbench-2795 ssh-h4wBuT7xFyHw
config-err-WrFjoB mysql-workbench-5071 systemd-private-e4a9a4a9be314d418d915a3f25277dbd-colord.service-50ieBM
core-js-banners net-export systemd-private-e4a9a4a9be314d418d915a3f25277dbd-rtkit-daemon.service-JMcX5n
gradle-5.2.1-bin.zip npm-18051-3750de93 systemd-private-e4a9a4a9be314d418d915a3f25277dbd-systemd-resolved.service-xppXU8
hsperfdata_dpc npm-23296-025e7dcd systemd-private-e4a9a4a9be314d418d915a3f25277dbd-systemd-timesyncd.service-F9KrkQ
insync1000.sock npm-23323-87c43dd4 Temp-61d1c1e2-ab46-43ee-aafa-f8c8a7b957a2
ionic-integration-cordova npm-23342-b38bf025 Temp-c88af337-2908-4462-8f4d-8b6a1709737e
lu313979exb61.tmp npm-23354-273d0b18 timeshift
mintUpdate npm-6939-6125689d 'VSCode Crashes'
mozilla_dpc0 pymp-6je4aj_t vscode-typescript1000
$ unzip gradle-5.2.1-bin.zip # OK, unzip it...
Archive: gradle-5.2.1-bin.zip
creating: gradle-5.2.1/
inflating: gradle-5.2.1/getting-started.html
inflating: gradle-5.2.1/LICENSE
creating: gradle-5.2.1/media/
inflating: gradle-5.2.1/media/gradle-icon-16x16.png
[...]
inflating: gradle-5.2.1/lib/plugins/junit-platform-commons-1.3.1.jar
inflating: gradle-5.2.1/lib/plugins/apiguardian-api-1.0.0.jar
inflating: gradle-5.2.1/lib/plugins/opentest4j-1.1.1.jar
$ ls ./gradle-5.2.1
bin getting-started.html init.d lib LICENSE media NOTICE
$ sudo cp -pr gradle-*/* /opt/gradle
$ ls /opt/gradle/
bin getting-started.html init.d lib LICENSE media NOTICE
$ ls -l /opt/gradle/
total 240
drwxr-xr-x 2 dpc dpc 4096 Feb 8 2019 bin
-rw-rw-r-- 1 dpc dpc 163877 Feb 8 2019 getting-started.html
drwxrwxr-x 2 dpc dpc 4096 Feb 8 2019 init.d
drwxr-xr-x 3 dpc dpc 4096 Feb 8 2019 lib
-rw-rw-r-- 1 dpc dpc 55261 Feb 8 2019 LICENSE
drwxrwxr-x 2 dpc dpc 4096 Feb 8 2019 media
-rw-rw-r-- 1 dpc dpc 802 Feb 8 2019 NOTICE
$ sudo mv gradle-5.2.1-bin.zip /opt/gradle/
$ rm -rf ./gradle-5.2.1/
$ sudo vi /etc/profile.d/gradle.sh
$ cat /etc/profile.d/gradle.sh
export PATH=/opt/gradle/bin:${PATH}
$ ls -l /etc/profile.d/gradle.sh
-rw-r--r-- 1 root root 36 Dec 24 10:35 /etc/profile.d/gradle.sh
$ sudo chmod +x /etc/profile.d/gradle.sh
$ ls -l /etc/profile.d/gradle.sh
-rwxr-xr-x 1 root root 36 Dec 24 10:35 /etc/profile.d/gradle.sh
$ source /etc/profile.d/gradle.sh
dpc@LT3-Insp17-2017:/tmp$ echo $PATH
/opt/gradle/bin:/home/dpc/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
$ gradle -v
Welcome to Gradle 5.2.1!
Here are the highlights of this release:
- Define sets of dependencies that work together with Java Platform plugin
- New C++ plugins with dependency management built-in
- New C++ project types for gradle init
- Service injection into plugins and project extensions
For more details see https://docs.gradle.org/5.2.1/release-notes.html
------------------------------------------------------------
Gradle 5.2.1
------------------------------------------------------------
Build time: 2019-02-08 19:00:10 UTC
Revision: f02764e074c32ee8851a4e1877dd1fea8ffb7183
Kotlin DSL: 1.1.3
Kotlin: 1.3.20
Groovy: 2.5.4
Ant: Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM: 1.8.0_231 (Oracle Corporation 25.231-b11)
OS: Linux 4.15.0-47-generic amd64
Essential history (for future script development):
Per issue comment: Deal w/ Missing "Gradle" Java CI/CD Pipeline Tool
From: How To Install Gradle on Ubuntu 18.04 / 16.04, Linux Mint 19 & Debian 9
OK, here we go...
Essential history (for future script development):