SlideShare a Scribd company logo
What's new in Gradle 4.0
Eric Wendelin — JavaOne 2017
Eric Wendelin
@eriwen
3-minute Gradle Overview
From mobile apps to microservices, from small
startups to big enterprises, Gradle helps teams
build, automate and deliver beGer soHware, faster.
Automate Everything
Integrates with other tools like
Docker for development or
opera7ons.
Integrates with and delegates to
NPM, MSBuild, Ant, and other
tools.
Build Anything
Support for Java, C/C++, Python,
JavaScript, Go, and other
languages.
Go monorepo, mul7-repo, or
anywhere in-between.
Trusted by Millions
Official build tool for Android
4M+ downloads per month
#17 on BaOery OSS Index
Gradle Overview
Languages built by Gradle
4%
7%
13%
21%
55%
GITHUB PUBLIC
SOURCE BYTES
Java
C
JS/CSS/HTML
C++
Groovy/Kotlin/Other
#BigQuery hOps://git.io/vQfUx
Gradle Build Anatomy
3-phase build:
IniKalizaKon → evaluate seNngs
ConfiguraKon → build task graph
ExecuKon → execute task graph
Evaluate Gradle scripts Execute tasksBuild DAG
Incremental Builds
TaskInputs Outputs
UP-TO-DATE
EXECUTE
same contents ? same contents ?
Gradle 3.0 => Sep 19, 2016
Gradle 4.0 => Jun 14, 2017
Gradle 4.2.1 => Current Version
Brief Gradle Version History
‣ Incremental Compile
‣ Compile Avoidance
‣ Build Cache
‣ Parallelism
Shipped since Gradle 3.0
Performance
✦ Buildship 2.0
✦ Kotlin DSL
✦ Improved CLI
✦ Build Scans
User Experience
❖ Java Library Plugin
❖ Java 9 Support
❖ NaKve Build Features
❖ Composite Builds
New Tools
Shipped since Gradle 3.0
‣ Incremental Compile
‣ Compile Avoidance
‣ Build Cache
‣ Parallelism
Performance
✦ Buildship 2.0
✦ Kotlin DSL
✦ Improved CLI
✦ Build Scans
User Experience
❖ Java Library Plugin
❖ Java 9 Support
❖ NaKve Build Features
❖ Composite Builds
New Tools
Incremental CompilaKon
Performance
• Analyze class dependencies to opKmize

which classes are recompiled
• Fast in-memory cache of class ABIs inside
daemon
Incremental Compila7on for Java
Lorem ipsum Lorem ipsum Lorem ipsum
Incremental Compila7on
Incremental Compila7on
tasks.withType(JavaCompile) {
options.incremental = true
}
Recommended JavaOne Talk: Maximizing
Incrementality with Gradle
- Cedric Champeau at 12:15pm tomorrow [CON2992]
Incremental Compila7on
Compile Avoidance
Performance
Gradle recognizes ABI breaking changes,
and will trigger recompilaKon only when ABI
is changed.
Compile Avoidance
Compile Avoidance Example
Does MyApp need
to be recompiled?
No!
edub.me/compile-avoidance
Build Cache
Performance
What's new in Gradle 4.0
buildCache {
local {
enabled = !isCI
}
remote(HttpBuildCache) {
url = "https://my.ge.server/cache/"
push = isCI
}
}
CI
Remote
Cache
Local
Cache
Developer
Build Cache
As of Gradle 4.2, Java and Scala toolchains are
cacheable by default. We're working on leveraging
this for all sensible tasks.
What's new in Gradle 4.0
Self-hosted Build Scans
Collect build history across all
Gradle builds.
Export build data; perform trend
analysis and data-driven
engineering effec7veness.
gradle.com/build-scans
Enterprise Build Cache
Easy installa7on and maintenance
tools for the Gradle Build Cache.
Enjoy much faster builds by
reusing task outputs across
machines.
gradle.com/build-cache
Support and ConsulQng
Get help migra7ng or upgrading
Gradle.
Expert build op7miza7on, saving
7me and improving developer
happiness.
gradle.org/services
Gradle Enterprise
Enterprise-grade Build Cache & Build Scans
gradle.com/build-cache
Parallelism
Performance
Parallel Dependency Downloads
Worker API
Without Worker API Using Worker API
edub.me/worker-api
Other Performance Improvements
Performance
• Faster configuraKon
• Faster gradle tasks
• Faster archive processing
• Faster daemon communicaKon
• lots more...
Performance Improvements
Gradle 4.2 is 2-100x faster than Gradle 3.0 when using
all of the new performance features — upgrade!
Summary
Shipped since Gradle 3.0
‣ Incremental Compile
‣ Compile Avoidance
‣ Build Cache
‣ Parallelism
Performance
✦ Buildship 2.0
✦ Kotlin DSL
✦ Improved CLI
✦ Build Scans
User Experience
❖ Java Library Plugin
❖ Java 9 Support
❖ NaKve Build Features
❖ Composite Builds
New Tools
Java Library Plugin
New Tools
compile: dependencies needed to compile

runtime: dependencies needed to run project
Java Library Plugin
Not sufficient!
There are at least 2 kinds of Java projects:
applicaQons (standalone, no API) 

libraries (exposes an API)
Java Library Plugin
// For Java Libraries that expose an API
- apply plugin: "java"
+ apply plugin: "java-library"
dependencies {
- compile "org.apache.commons:commons-math3:3.6.1"
- compile "com.google.guava:21.0"
+ api "org.apache.commons:commons-math3:3.6.1"
+ implementation "com.google.guava:21.0"
}
edub.me/java-library-plugin
Java 9 Support
New Tools
Gradle 4.2.1 provides runKme support for Java 9
applicaKons and libraries.
It does not have first-class support for Java 9
modules yet.
Java 9 Support
1. Add module-info.java
2. Modify JavaCompile tasks to produce
modules
3. Modify compile test tasks to patch modules
4. Modify Test tasks to consume patched
modules
Adop7ng Java 9 modules using Gradle
Using Java 9 modules with Gradle
ext.moduleName = "org.gradle.actors"
compileJava {
inputs.property("moduleName", moduleName)
doFirst {
options.compilerArgs = ["--module-path", classpath.asPath]
classpath = project.files()
}
}
Java 9 Support
plugins {
id "org.gradle.java.experimental-jigsaw" version "0.1.1"
}
DO NOT USE THIS PLUGIN IN PRODUCTION!
edub.me/gradle-java9
NaKve Build Features
New Tools
• Parallel compilaKon and linking by default
• VS2015 Support
• Build Dependents
Na7ve Build Features
Composite Builds
New Tools
gradle myTask --include-build ../separate-project
| X
Composite Builds
• Combine independent Gradle builds
• SubsKtute binary with project dependencies
• Quick local experimentaKon
• Cross-repository refactoring
• Smooth migraKon from monolith to mulK-repo
• Faster plugin prototyping
What's new in Gradle 4.0
edub.me/composite-builds
Shipped since Gradle 3.0
‣ Incremental Compile
‣ Compile Avoidance
‣ Build Cache
‣ Parallelism
Performance
✦ Buildship 2.0
✦ Kotlin DSL
✦ Improved CLI
✦ Build Scans
User Experience
❖ Java Library Plugin
❖ Java 9 Support
❖ NaKve Build Features
❖ Composite Builds
New Tools
Buildship 2.0
User Experience
• Composite Build support
• Fresh new design
• --offline mode support
Buildship 2.0
Kotlin DSL
User Experience
What's new in Gradle 4.0
• Auto-compleKon and content assist
• Quick documentaKon
• NavigaKon to source
• Refactoring and more
Kotlin DSL
edub.me/kotlin-dsl-samples
Improved CLI
User Experience
What's new in Gradle 4.0
What's new in Gradle 4.0
What's new in Gradle 4.0
What's new in Gradle 4.0
What's new in Gradle 4.0
What's new in Gradle 4.0
What's new in Gradle 4.0
What's new in Gradle 4.0
What's new in Gradle 4.0
What's new in Gradle 4.0
What's new in Gradle 4.0
What's new in Gradle 4.0
git.io/gradle-compleKon
• CompleKon for tasks, flags, and common
properKes
• Available for bash and zsh
• Kotlin build scripts support
• ~20x faster than alternaKves for medium
to large projects
Build Scans
User Experience
What's new in Gradle 4.0
• Persistent
• Shareable
• Customizable
• Fast
Build Scans
What's new in Gradle 4.0
What's new in Gradle 4.0
• Trend analysis
• A/B tesKng (Build Comparison)
• Flaky test detecKon
• Engineering workflow opKmizaKon
Pufng Build Scans Together
What's new in Gradle 4.0
gradle.com/build-scans
gradle myTask --scan
‣ Incremental Compile
‣ Compile Avoidance
‣ Build Cache
‣ Parallelism
Shipped since Gradle 3.0
Performance
✦ Buildship 2.0
✦ Kotlin DSL
✦ Improved CLI
✦ Build Scans
User Experience
❖ Java Library Plugin
❖ Java 9 Support
❖ NaKve Build Features
❖ Composite Builds
New Tools
• gradle.org/guides — Get started using
various technologies with Gradle
• gradle.org/training — Monthly free online
training with core engineers
• gradle.com/enterprise — Build together;
not alone
Learn More
@eriwen
@gradle
w
Thank You
Eric Wendelin — @eriwen

More Related Content

PDF
Building the Web with Gradle
PPT
Introduction to Grails
PDF
GraphQL Bangkok Meetup 6.0
PPTX
Groovy & Grails - From Scratch to Production
PPTX
Lightning Web Components by Abdul Gafoor
PPTX
Neo4J and Grails
PPTX
Lightning talk how to edit the Silverstripe CMS docs
PPTX
html5?
Building the Web with Gradle
Introduction to Grails
GraphQL Bangkok Meetup 6.0
Groovy & Grails - From Scratch to Production
Lightning Web Components by Abdul Gafoor
Neo4J and Grails
Lightning talk how to edit the Silverstripe CMS docs
html5?

What's hot (20)

PDF
Importance of GCP: 30 Days of GCP
PDF
Javaone - Gradle: Harder, Better, Stronger, Faster
PPTX
PPTX
Gradle build capabilities
PDF
Kubernetes at Reddit: An Origin Story - KubeCon NA 2018
PPTX
Develop, deploy, and operate services at reddit scale oscon 2018
PPTX
Ruby on Rails: Outreach for Women, SF
PPT
Google Web Toolkit
PPTX
Helm at reddit: from local dev, staging, to production
PPTX
Meetup 23 - 03 - Application Delivery on K8S with GitOps
PDF
Blazing fast sites using Blaze, Hybrid CMS NYC
PDF
Designing a complete ci cd pipeline using argo events, workflow and cd products
PPTX
Kubernetes: Increasing velocity without sacrificing quality
PPTX
Heroku - A ployglot Platform (Add-on)
PDF
Griffon for the Enterprise
PPTX
Scaling a conventional CI infrastructure in the public cloud
PDF
Introduction à GWT
PPSX
Web And Cloud Tour 2015 - ASP.NET 5
PDF
Bringing JAMStack to the Enterprise
PDF
The Graph-Native Advantage
Importance of GCP: 30 Days of GCP
Javaone - Gradle: Harder, Better, Stronger, Faster
Gradle build capabilities
Kubernetes at Reddit: An Origin Story - KubeCon NA 2018
Develop, deploy, and operate services at reddit scale oscon 2018
Ruby on Rails: Outreach for Women, SF
Google Web Toolkit
Helm at reddit: from local dev, staging, to production
Meetup 23 - 03 - Application Delivery on K8S with GitOps
Blazing fast sites using Blaze, Hybrid CMS NYC
Designing a complete ci cd pipeline using argo events, workflow and cd products
Kubernetes: Increasing velocity without sacrificing quality
Heroku - A ployglot Platform (Add-on)
Griffon for the Enterprise
Scaling a conventional CI infrastructure in the public cloud
Introduction à GWT
Web And Cloud Tour 2015 - ASP.NET 5
Bringing JAMStack to the Enterprise
The Graph-Native Advantage
Ad

Similar to What's new in Gradle 4.0 (20)

PDF
From GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX Apps
PDF
Keeping your build tool updated in a multi repository world
PDF
Make Your Build Great Again (DroidConSF 2017)
PDF
Gradle - Build System
PDF
Szczepan.faber.gradle
PDF
Gradle - Build system evolved
PDF
Enterprise build tool gradle
PDF
Gradle - the Enterprise Automation Tool
PPTX
Grails Spring Boot
PPTX
Gradle: One technology to build them all
PPTX
[20200720]cloud native develoment - Nelson Lin
PPTX
Faster Java EE Builds with Gradle
PPTX
Faster Java EE Builds with Gradle
PPTX
Faster java ee builds with gradle [con4921]
PDF
Introduction to gradle
PDF
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud Environments
PPTX
PDF
Hands on the Gradle
PPTX
Dirigible powered by Orion for Cloud Development (EclipseCon EU 2015)
PPTX
Gradle,the new build system for android
From GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX Apps
Keeping your build tool updated in a multi repository world
Make Your Build Great Again (DroidConSF 2017)
Gradle - Build System
Szczepan.faber.gradle
Gradle - Build system evolved
Enterprise build tool gradle
Gradle - the Enterprise Automation Tool
Grails Spring Boot
Gradle: One technology to build them all
[20200720]cloud native develoment - Nelson Lin
Faster Java EE Builds with Gradle
Faster Java EE Builds with Gradle
Faster java ee builds with gradle [con4921]
Introduction to gradle
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud Environments
Hands on the Gradle
Dirigible powered by Orion for Cloud Development (EclipseCon EU 2015)
Gradle,the new build system for android
Ad

More from Eric Wendelin (9)

PDF
Gradle by Example
PDF
Gradle 3.0: Unleash the Daemon!
PDF
JavaScript + Jenkins = Winning!
PDF
Test your Javascript! v1.1
PDF
Groovy-er desktop applications with Griffon
PDF
Intro to Hadoop
KEY
Javascript Stacktrace Ignite
PDF
Apache Avro and You
KEY
Testing Hadoop jobs with MRUnit
Gradle by Example
Gradle 3.0: Unleash the Daemon!
JavaScript + Jenkins = Winning!
Test your Javascript! v1.1
Groovy-er desktop applications with Griffon
Intro to Hadoop
Javascript Stacktrace Ignite
Apache Avro and You
Testing Hadoop jobs with MRUnit

Recently uploaded (20)

PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
history of c programming in notes for students .pptx
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
AI in Product Development-omnex systems
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
Online Work Permit System for Fast Permit Processing
PPTX
ISO 45001 Occupational Health and Safety Management System
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
Navsoft: AI-Powered Business Solutions & Custom Software Development
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
ManageIQ - Sprint 268 Review - Slide Deck
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
How Creative Agencies Leverage Project Management Software.pdf
history of c programming in notes for students .pptx
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
2025 Textile ERP Trends: SAP, Odoo & Oracle
Operating system designcfffgfgggggggvggggggggg
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
AI in Product Development-omnex systems
PTS Company Brochure 2025 (1).pdf.......
Softaken Excel to vCard Converter Software.pdf
Online Work Permit System for Fast Permit Processing
ISO 45001 Occupational Health and Safety Management System
Upgrade and Innovation Strategies for SAP ERP Customers
Design an Analysis of Algorithms II-SECS-1021-03
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
How to Migrate SBCGlobal Email to Yahoo Easily

What's new in Gradle 4.0