Gradle:Part 1, Introduction to Gradle

Gradle:Part 1, Introduction to Gradle

This tutorial is divided into 4 parts

Part 1: Introduction to Gradle, comparison with others and motivation

Part 2: Installing Gradle on local Machine.

Part 3: Setup Java project using Gradle.

Part 4: Creating an executable jar using Gradle task.

Introduction

Gradle is an open-source build automation tool focused on flexibility and performance. Gradle nicely combines both Ant and Maven, taking the best from both frameworks. It uses domain-specific language based on the programming language Groovy or Kotlin, differentiating it from Apache Maven, which uses XML for its project configuration.

How Gradle compares with Maven or Apache Ant

Google has chosen Gradle as the official build tool for Android. Both Gradle and Maven provide convention over configuration. However, Maven provides a very rigid model that makes customizations tedious and sometimes impossible.

Gradle has better performance as compared to maven .The top 3 features that make Gradle much faster than Maven are:

Incrementality – Gradle avoids work by tracking input and output of tasks and only running what is necessary, and only processing files that changed when possible.

Build Cache – Reuses the build outputs of any other Gradle build with the same inputs, including between machines.

Gradle Daemon – A long-lived process that keeps build information “hot” in memory.

In Gradle you can either use DSL Groovy or Kotlin as compared to XML in Apache Maven. In sense you can do programming and write tasks using Groovy or Kotlin which is comparitively difficult in maven.

Apache Ant is also one more player with maven. Ant is total flexible like gradle and using Ivy gives better dependency management than Maven. But it doesn’t have great support for multi-project builds.

The stack share of Gradle vs others can be seen on stackshare.We can also look upto leaders who use Gradle in open source projects like Elastic Search , Hibernate-Orm,ReactiveX RxJava,libgdx, CrateDB, Many Netflix Open source Projects, and even Andriod SDK and lot more.

So now let’s start with the installation of Gradle on the local machine. We will do the installation in Part 2.

Share This Post

One Response to "Gradle:Part 1, Introduction to Gradle"

Post Comment