Introduction to Gradle

Palanivelrajan Balasubramanian

What is Gradle?

  • Build System
  • Rich DSL based on Groovy
  • Support build-by-convention
  • Very flexible and configurable
  • Built -in plugins for java, groovy, scala, springboot
  • Integrates well with ivy, maven and Ant
  • Free and Open Source

Features

  • Excellent dependency management
  • Groovy as a base language make it a very powerful build system.
  • Incremental build support
  • State of art support for multi project build
  • Apache Ant is a first class citizen
  • Dynamic tasks

Gradle Users

  • Hibernate
  • Spring framework
  • Spring Security
  • Spring Integration
  • Grails
  • Groovy
  • Manhattan Associates :)

Basic Features and Principals

  • Hello Gradle 
  • Task Configuration and Execution
  • Gradle , Groovy and Java
  • Java Project
  • Java Plugin Tasks https://docs.gradle.org/current/userguide/java_plugin.html
  • Extending Task
  • Ant tasks can be used; You can even import a complete ant build file!

Project and Tasks

  • A Gradle project is any goal what we want to do with Gradle, assemble a JAR, compile a Java project, run Unit tests, deploy an application.
  • A Gradle task is the minimum unit of work, represents an atomic piece of work. The main goal is define some tasks to accomplish a Project.

Gradle Build Life Cycle

Gradle, Groovy and Java

Java Plugin

Java plugin auto

Extending Tasks

Files and Collection

File and File collection

Copying Files

Dependency Management

Repository Configuration

Reference dependencies

Transitive Dependency

Multi Project Build

  • One Build file for the whole multi project
  • All properties, settings, dependencies, plugins are derived without duplication
  • Can override everything in child builds
Made with Slides.com