Article

Table of Contents
Theme:
Was this article helpful?

1  out of  1 found this helpful

Try Vultr Today with

$50 Free on Us!

Want to contribute?

You could earn up to $600 by adding new articles.

How to Install Gradle on Ubuntu 16.10

Last Updated: Thu, Mar 30, 2017
Java Linux Guides Server Apps Ubuntu
Archived content

This article is outdated and may not work correctly for current operating systems or software.

Gradle is a free and open source build automation toolset based on the concepts of Apache Ant and Apache Maven. Gradle provides a platform to support the entire development lifecycle of a software project.

In this tutorial, we will install the latest version of Gradle on Ubuntu 16.10.

Prerequisites

  • A Vultr Ubuntu 16.10 server instance.

  • A sudo user.

Step 1: Update the System

Before installing any packages on your Ubuntu server instance, it is recommended to update the system. Login using the sudo user and run the following commands to update the system.

sudo apt-get update

sudo apt-get -y upgrade

Step 2: Install JDK

Gradle requires Java Development Kit (JDK) 7 or higher in order to work. In this tutorial we will be installing JDK 8. Run the following command to install JDK 8 on your server.

sudo apt-get -y install openjdk-8-jdk wget unzip

The above command will also install wget and unzip. Verify the installation.

java -version

You will see the following output.

openjdk version "1.8.0_121"

OpenJDK Runtime Environment (build 1.8.0_121-8u121-b13-0ubuntu1.16.10.2-b13)

OpenJDK 64-Bit Server VM (build 25.121-b13, mixed mode)

Step 3: Download Gradle

Gradle distribution archive comes in two types: "binary-only" and "complete". The "binary-only" archive contains the Gradle software only wheres "complete" archive comes with binary, documentation and source. Run the following command to download Gradle to your system.

wget https://services.gradle.org/distributions/gradle-3.4.1-bin.zip

You can always check the Gradle release page to look for the link to the latest version of Gradle.

Step 4: Install Gradle

Create a directory for the Gradle installation.

sudo mkdir /opt/gradle

Extract the downloaded archive to the newly created directory.

sudo unzip -d /opt/gradle gradle-3.4.1-bin.zip

Configure the PATH environment variable so that the gradle executable can be directly executed anywhere on the system.

export PATH=$PATH:/opt/gradle/gradle-3.4.1/bin

You can run the following command to check if the Gradle install was successful.

gradle -v

You should see the following output.

------------------------------------------------------------

Gradle 3.4.1

------------------------------------------------------------



Build time:   2017-03-03 19:45:41 UTC

Revision:     9eb76efdd3d034dc506c719dac2955efb5ff9a93



Groovy:       2.4.7

Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015

JVM:          1.8.0_121 (Oracle Corporation 25.121-b13)

OS:           Linux 4.8.0-41-generic amd64

The installation is complete. Your system is now ready to build programs using Gradle.

Want to contribute?

You could earn up to $600 by adding new articles.