Introduction to Gradle

Learn how to better manage and build your projects using Gradle.

Overview

Within Agile methods such as SCRUM and Kanban, automated build management is essential to enable continuous testing, integration and deployment. Without a fully autonomous ‘build->test->release’ cycle to act as its heartbeat an Agile team has no effective means of detecting errors or measuring progress. Additionally if the build system is not self contained and isolated from external dependencies it is difficult for developers to transfer their work between machines and setup new ones.

Traditionally, build management in Java has been based around Maven. Whilst Maven enables rapid progress at the beginning of a project its inflexibility quickly leads to issues as the project grows. In particular the XML based syntax and complex underlying architecture means that customizing the framework for bespoke project needs is an arduous process.

Gradle is an alternative to Maven which has quickly overtaken it as the default build tool in JEE. Unlike Maven, a Gradle build script is a program written in the Groovy JVM scripting language, making it trivial to inject arbitrary functionality into the build process. This DSL (Domain Specific Language) based approach is the same as that used to great effect within the ‘Ruby on Rails’ web framework.

Gradle embeds micro frameworks (aka Plugins) which support all the standard tasks required of a built tool. It is fully interoperable with Maven and can, for example, download libraries from existing Maven repositories. In addition, it is designed to enable the modern style of ‘polyglot programming’ – where multiple JVM languages are used within the same project.

This course will enable developers to manage their builds with Gradle, extend the tool to shorten and simplify their deployment process and use Gradles power features to explore new forms of software development.

Outline

Overview of Build Automation

  • The early days of Make and Ant
  • How Rake pioneered DSL’s in ‘RoR’
  • Why Maven became dominant in JEE
  • Issues with the Maven approach
  • The emergence of Gradle

Introduction to Groovy

  • Dynamic typing within the JVM
  • Basic syntax and concepts
  • Closures and functional programming
  • Techniques for building DSL’s

Introducing Gradle

  • Creating a build script for a console application
  • Making the script self contained via the Wrapper
  • Configuring and connecting to repositories
  • Managing dependencies and creating discrete scopes
  • Exclusions and controlling transitive dependencies

Gradle Builds in Depth

  • The lifecycle of a build within Gradle
  • Creating a graph of inter-dependent tasks
  • Managing the file system and source code control (VCS)
  • Configuring source sets using the Java plugin
  • Installing and managing additional plugins
  • Enabling TDD, BDD and CI using Gradle plugins
  • How the Gradle Daemon reduces startup times
  • Documenting your script for external use

Advanced Uses of Gradle

  • Building multi-module JEE Web Applications
  • Enabling use of Java, Scala and Clojure within the same project
  • Running code quality tools (Checkstyle, Jacoco, PMD etc…)
  • Using Gradle to build Android and iOS mobile applications
  • Supporting alternative Java Web Architectures (e.g. Play)
  • Advantages of using Gradle to build C and C++ projects

Requirements

  • Delegates must be proficient with a JVM language (Java, Groovy, Scala or Clojure) with at least one years experience developing applications in industry

Sign up and stay in the loop

Be the first to know about upcoming workshops, courses, talks and events

Learn more

Excellent course - packed full of information and I'm looking forward to delving deeper in my own time.