How to install Gradle on Debian 8.3

How to install Gradle on Debian 8.3

Gradle is an open source build automation system that builds upon the concepts of Apache Ant and Apache Maven. This article explains the installation of Gradle on Debian 8.3


Installation process

The very first thing to do before installing Gradle is to open the apt source list. Use nano command for that purpose.

root@linuxhelp:~# nano /etc/apt/sources.list
deb http://ftp.debian.org/debian/ stable main contrib non-free
deb http://ftp.de.debian.org/debian jessie main


Next update the apt source by using apt-get update command.

root@linuxhelp:~# apt-get update
Get:1 http://ftp.debian.org jessie-updates InRelease [145 kB]
Ign http://ftp.de.debian.org jessie InRelease           
Hit http://ftp.de.debian.org jessie Release.gpg         
Hit http://ftp.de.debian.org jessie Release
Hit http://ftp.de.debian.org jessie/main amd64 Packages   
Hit http://ftp.de.debian.org jessie/main Translation-en                  
Ign http://ftp.debian.org stable InRelease                               
Get:2 http://ftp.debian.org jessie-updates/main Sources [15.4 kB]
Get:3 http://ftp.debian.org jessie-updates/contrib Sources [32 B]     
Get:4 http://ftp.debian.org jessie-updates/main amd64 Packages/DiffIndex [6,916 B]
Get:5 http://ftp.debian.org jessie-updates/contrib amd64 Packages [32 B]
Get:6 http://ftp.debian.org jessie-updates/contrib Translation-en [14 B]
Get:7 http://ftp.debian.org jessie-updates/main Translation-en/DiffIndex [2,704 B]
Hit http://ftp.debian.org stable Release.gpg
Hit http://ftp.debian.org stable Release
Hit http://ftp.debian.org stable/main amd64 Packages
Hit http://ftp.debian.org stable/contrib amd64 Packages
Hit http://ftp.debian.org stable/non-free amd64 Packages
Hit http://ftp.debian.org stable/contrib Translation-en
Hit http://ftp.debian.org stable/main Translation-en
Hit http://ftp.debian.org stable/non-free Translation-en
Fetched 170 kB in 5s (30.5 kB/s)
Reading package lists... Done

Now is the time to install the Gradle package by invoking the following command.

root@linuxhelp:~# apt-get install gradle
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libasn1-8-heimdal libgssapi3-heimdal libhcrypto4-heimdal
  libheimbase1-heimdal libheimntlm0-heimdal libhx509-5-heimdal
  libkrb5-26-heimdal libroken18-heimdal libwind0-heimdal
Use ' apt-get autoremove'  to remove them.
The following extra packages will be installed:
  ant ant-optional antlr aspectj bnd bsh checkdata-style fop groovy
.
.
.
.
etting up libcommons-jxpath-java (1.3-6) ...
Setting up libjetty-extra (6.1.26-4) ...
Setting up libsaxon-java (1:6.5.5-10) ...
Setting up libxom-java (1.2.10-1) ...
Setting up rhino (1.7R4-3) ...
update-alternatives: using /usr/bin/rhino to provide /usr/bin/js (js) in auto mode
Setting up libgeronimo-jpa-2.0-spec-java (1.1-2) ...
Setting up libmaven-scm-java (1.3-5) ...
Setting up libwagon-java (1.0.0-5) ...
Setting up libwagon2-java (2.7-1) ...
Setting up libcommons-vfs-java (2.0-3) ...
Setting up libosgi-compendium-java (4.3.0-1) ...
Setting up libgeronimo-osgi-support-java (1.0-2) ...
Setting up bnd (1.50.0-8) ...
Setting up libmaven2-core-java (2.2.1-17) ...
Setting up libplexus-containers1.5-java (1.5.5-6) ...
Setting up libsisu-ioc-java (2.3.0-5) ...
Setting up libaether-java (1.13.1-2) ...
Setting up maven (3.0.5-3) ...
update-alternatives: using /usr/share/maven/bin/mvn to provide /usr/bin/mvn (mvn) in auto mode
Setting up libgradle-core-java (1.5-2) ...
Setting up libgradle-plugins-java (1.5-2) ...
Setting up gradle (1.5-2) ...
Processing triggers for libc-bin (2.19-18+deb8u7) ...

Gradle has been installed, use the following command to launch the application.

root@linuxhelp:~# gradle
:help
Welcome to Gradle 1.5.
To run a build, run gradle < task>  ...
To see a list of available tasks, run gradle tasks
To see a list of command-line options, run gradle --help
BUILD SUCCESSFUL
Total time: 2.066 secs

It was a simple installation method, isn' t it? Gradle is a cool automation tool. It uses a novel feature called as Groovy-based domain-specific language (DSL) for the project configuration. Also, to determine the order in which the task has to be run, it uses the Directed Acyclic Graph, also called as DAG.

Tag : Gradle
FAQ
Q
How to modify jvmArguments of runIde task?
A
"runIde task is a Java Exec task and can be modified according to the documentation.

To add some jvm arguments while launching IDE, configure runIde task in the following way:

runIde {
jvmArgs '-DmyProperty=value'
}"
Q
How to modify system properties of runIde task?
A
"Using the very same task documentation, configure runIde task:

runIde {
systemProperty('name', 'value' )
}"
Q
"Is there a way to run a specific Android unit test using Gradle? I've tried

gradle -Dtest.single=UnitTestName connectedInstrumentTest
but it seems to run all the tests in the package. What will do?"
A
"Using test. single appears to be deprecated. The new correct way to do this is

./gradlew ::test --tests "
Q
Why run 'gradle clean'?
A
The clean task is defined by the Java plugin and it simply removes the buildDir folder, thus cleaning everything including leftovers from previous builds which are no longer relevant.
Q
How to Building the Plugin in gradle?
A
"To build the plugin, just type the following command:

./gradlew clean build"