YouTube Icon

Code Playground.

How to Install Gradle on CentOS 7

CFG

How to Install Gradle on CentOS 7

Gradle is an open-source fabricate robotization framework utilized essentially for Java ventures. It consolidates the best highlights of Ant and Maven . Not at all like its archetypes which use XML for scripting, Gradle utilizes Groovy , a dynamic, object-situated programming language for the Java stage to characterize the undertaking and assemble contents. 

This instructional exercise traces the means important to introduce the most recent variant of Gradle on CentOS 7 frameworks. 

Prerequisites

The client you are signing in as must have sudo advantages to have the option to introduce bundles. 

Installing Gradle on CentOS

The accompanying segments give data about how to introduce Gradle on CentOS 7. We'll download the most recent arrival of Gradle from their official site. 

1. Install OpenJDK

Gradle requires Java JDK or JRE adaptation 7 or above to be introduced. 

Introduce the OpenJDK 8 bundle with the accompanying order: 

sudo yum install java-1.8.0-openjdk-devel

Confirm the Java establishment by printing the Java form : 

java -version

The yield should look something like this: 

openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)

2. Download Gradle 

At the hour of composing this article, the most recent rendition of Gradle is 5.0. Prior to proceeding with the following stage you should check the Gradle discharges page to check whether a more up to date form is accessible. 

Start by downloading the Gradle Binary-just compress document in the/tmp catalog utilizing the accompanying wget order: 

wget https://services.gradle.org/distributions/gradle-5.0-bin.zip -P /tmp

When the download is finished, extricate the compress record in the/select/gradle registry: 

sudo unzip -d /opt/gradle /tmp/gradle-5.0-bin.zip

Confirm that the Gradle records are extricated by posting the/pick/gradle/gradle-5.0 catalog: 

ls /opt/gradle/gradle-5.0
bin  getting-started.html  init.d  lib  LICENSE  media  NOTICE

3. Setup environment variables

The following stage is to design the PATH climate variable to incorporate the Gradle receptacle registry. To do as such, open your content manager and make another document named gradle.sh within the/and so on/profile.d/index. 

sudo nano /etc/profile.d/gradle.sh

Glue the accompanying design: 

/etc/profile.d/gradle.sh

export GRADLE_HOME=/opt/gradle/gradle-5.0
export PATH=${GRADLE_HOME}/bin:${PATH}

Spare and close the record. This content will be sourced at shell startup. 

Make the content executable by giving the accompanying chmod order: 

sudo chmod +x /etc/profile.d/gradle.sh

Burden the climate factors utilizing the source order : 

source /etc/profile.d/gradle.sh

4. Verify the Gradle installation

To approve that Gradle is introduced appropriately utilize the gradle - v order which will show the Gradle form: 

gradle -v

You should see something like the accompanying: 

Welcome to Gradle 5.0!

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.0/release-notes.html


------------------------------------------------------------
Gradle 5.0
------------------------------------------------------------

Build time:   2018-11-26 11:48:43 UTC
Revision:     7fc6e5abf2fc5fe0824aec8a0f5462664dbcd987

Kotlin DSL:   1.0.4
Kotlin:       1.3.10
Groovy:       2.5.4
Ant:          Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM:          1.8.0_191 (Oracle Corporation 25.191-b12)
OS:           Linux 3.10.0-862.14.4.el7.x86_64 amd64

That is it. The most recent adaptation of Gradle is currently introduced on your CentOS framework. 

Conclusion

You have effectively introduced Gradle on your CentOS 7. You would now be able to visit the authority Gradle Documentation page and figure out how to begin with Gradle. 

In the event that you hit an issue or have criticism, leave a remark underneath.




CFG