SlideShare a Scribd company logo
Gradle Ex Machina
Andres Almiray
@aalmiray
Gradle Ex Machina - Devoxx 2019
The preceding is intended to outline our general product direction. It is intended for information purposes
only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code,
or functionality, and should not be relied upon in making purchasing decisions. The development,
release, timing, and pricing of any features or functionality described for Oracle’s products may change
and remains at the sole discretion of Oracle Corporation.
Statements in this presentation relating to Oracle’s future plans, expectations, beliefs, intentions and
prospects are “forward-looking statements” and are subject to material risks and uncertainties. A detailed
discussion of these factors and other risks that affect our business is contained in Oracle’s Securities
and Exchange Commission (SEC) filings, including our most recent reports on Form 10-K and Form 10-
Q under the heading “Risk Factors.” These filings are available on the SEC’s website or on Oracle’s
website at http://www.oracle.com/investor. All information in this presentation is current as of September
2019 and Oracle undertakes no duty to update any statement in light of new information or future
events.
Safe Harbor
Copyright © 2019 Oracle and/or its affiliates.
Gradle Ex Machina - Devoxx 2019
pom.xml
‱ POM stands for Project Object Model.
‱ A POM file defines both how a project should be built and how
consumers may interact with the published artifacts.
‱ Maven delivers lots of features out of the box thanks to the
hierarchical nature of the POM.
‱ The Maven Super POM provides default configuration for
common plugins such as compiler, resources, surefire, etc.
‱ The strict nature of the structure found in the POM allows anyone
to understand the configuration.
Gradle Ex Machina - Devoxx 2019
build.gradle
‱ Gradle build files only specify how projects should be built.
‱ The definition for consumers is delivered through a generated
POM file.
‱ Gradle builds are highly customizable, resulting in a wider range
of build patterns.
Can we have a maven-like
structure on top of gradle?
Not Maven!
http://github.com/aalmiray/kordamp-gradle-plugins
https://aalmiray.github.io/kordamp-gradle-plugins
Project DSL
The project plugin
plugins {‹
id 'org.kordamp.gradle.project' version ‘0.29.0’
}‹
‹
config {‹
release = (rootProject.findProperty('release') ?: false).toBoolean()‹
‹
info {‹
name = 'Sample'‹
vendor = 'Acme'‹
description = 'Sample project'‹
‹
links {‹
website = 'https://github.com/joecool/sample'‹
issueTracker = 'https://github.com/joecool/sample/issues'‹
scm = 'https://github.com/joecool/sample.git'‹
}‹
‹
people {‹
person {‹
id = 'joecool'‹
name = 'Joe Cool'‹
roles = ['developer']‹
}‹
}‹
}


}
Provided behavior
‱ The project plugin applies the following plugins
org.kordamp.gradle.base
org.kordamp.gradle.build-info
org.kordamp.gradle.minpom
org.kordamp.gradle.jar
org.kordamp.gradle.source-jar
org.kordamp.gradle.javadoc
org.kordamp.gradle.license
org.kordamp.gradle.jacoco
org.kordamp.gradle.publishing
org.kordamp.gradle.testing
org.kordamp.gradle.apidoc
org.kordamp.gradle.source-stats
org.kordamp.gradle.source-html
org.kordamp.gradle.bintray
org.kordamp.gradle.base
Default tasks
‱ Gradle provides the following tasks
projects
dependencies
properties
tasks
Additional tasks
‱ The base plugin provides the following tasks
extensions
plugins
repositories
configurations
repositories
sourceSets
projectProperties
effectiveSettings
java/groovy/scala compileSettings
testSettings
publicationSettings
Demo
Gradle Ex Machina - Devoxx 2019
Gradle Ex Machina - Devoxx 2019
Gradle Ex Machina - Devoxx 2019
Additional plugins
‱ The following plugins can be applied explicitly
org.kordamp.gradle.kotlindoc
org.kordamp.gradle.scaladoc
org.kordamp.gradle.source-xref
org.kordamp.gradle.bom
org.kordamp.gradle.clirr
org.kordamp.gradle.guide
org.kordamp.gradle.integration-test
org.kordamp.gradle.functional-test
Super POM
The Maven super POM
‱ POMs are hierarchical.
‱ The chain resolves all the way to the top where you find the
Maven Super POM.
‱ Super POM configures lots of default & useful behavior.
The Gradle super POM
‱ Gradle does not offer this behavior out of the box.
‱ But it can be “faked” using a custom plugin.
‱ The plugin applies the default behavior that consuming projects
require.
Gradle Super POM
demo
File structure
Standard (gradle)
.
├── build.gradle
├── guide
│   └── build.gradle
├── project1
│   └── build.gradle
├── project2
│   └── build.gradle
└── settings.gradle
.
├── build.gradle
├── guide
│   └── guide.gradle
├── project1
│   └── project1.gradle
├── project2
│   └── project2.gradle
└── settings.gradle
Standard (gradle)
$ cat settings.gradle
include 'guide'
include 'project1'
include 'project2'
$ cat settings.gradle
include 'guide'
include 'project1'
include 'project2’
project(':guide').buildFileName =
'guide.gradle'
project(':project1').buildFileName =
'project1.gradle'
project(':project2').buildFileName =
'project2.gradle'
Standard (gradle)
$ cat settings.gradle
buildscript {‹
repositories {‹
gradlePluginPortal()‹
}‹
dependencies {‹
classpath 'org.kordamp.gradle:settings-gradle-plugin:0.29.0‹
}‹
}
‹
apply plugin: 'org.kordamp.gradle.settings'‹
‹
projects {‹
layout = 'standard'‹
}
Two-level (gradle)
.
├── build.gradle
├── docs
│   └── guide
│       └── build.gradle
└── subprojects
    ├── project1
    │   └── build.gradle
    └── project2
        └── build.gradle
.
├── build.gradle
├── docs
│   └── guide
│       └── guide.gradle
└── subprojects
    ├── project1
    │   └── project1.gradle
    └── project2
        └── project2.gradle
Two-level (gradle)
$ cat settings.gradle
include 'guide'
include 'project1'
include 'project2'
project(':guide').projectDir = new File(“$settingsDir/docs/guide”)
project(':project1').projectDir = new File(“$settingsDir/subprojects/project1”)
project(':project2').projectDir = new File(“$settingsDir/subprojects/project2”)
// update names if required
project(':guide').buildFileName = 'guide.gradle'
project(':project1').buildFileName = 'project1.gradle'
project(':project2').buildFileName = 'project2.gradle'
Two-level (gradle)
$ cat settings.gradle
buildscript {‹
repositories {‹
gradlePluginPortal()‹
}‹
dependencies {‹
classpath 'org.kordamp.gradle:settings-gradle-plugin:0.29.0‹
}‹
}
‹
apply plugin: 'org.kordamp.gradle.settings'‹
‹
projects {‹
layout = 'two-level'
directories = ['docs', 'subprojects']‹
}
Multi-level (gradle)
.
├── build.gradle
├── guide
│   └── build.gradle
└── subprojects
    ├── project1
    │   └── build.gradle
    └── project2
        └── build.gradle
.
├── build.gradle
├── guide
│   └── guide.gradle
└── subprojects
    ├── project1
    │   └── project1.gradle
    └── project2
        └── project2.gradle
Multi-level (gradle)
$ cat settings.gradle
buildscript {‹
repositories {‹
gradlePluginPortal()‹
}‹
dependencies {‹
classpath 'org.kordamp.gradle:settings-gradle-plugin:0.29.0‹
}‹
}
‹
apply plugin: 'org.kordamp.gradle.settings'‹
‹
projects {‹
layout = 'multi-level'‹
directories = [‹
'guide',‹
'subprojects/project1',‹
'subprojects/project2'‹
]‹
}
Gradle Ex Machina - Devoxx 2019
http://andresalmiray.com/newsletter
http://andresalmiray.com/editorial
Gradle Ex Machina - Devoxx 2019
Thank you!
ANDRES ALMIRAY
@AALMIRAY
ANDRESALMIRAY.COM

More Related Content

PDF
BDD with JBehave
PDF
AngularJS Beginner Day One
PDF
Andres Almiray - Gradle Ex Machina - Codemotion Rome 2019
PDF
Gradle ex-machina
PDF
Creating Better Builds with Gradle
PDF
ICONUK 2015 - Gradle Up!
PPTX
Faster java ee builds with gradle [con4921]
PPTX
BDD with JBehave
AngularJS Beginner Day One
Andres Almiray - Gradle Ex Machina - Codemotion Rome 2019
Gradle ex-machina
Creating Better Builds with Gradle
ICONUK 2015 - Gradle Up!
Faster java ee builds with gradle [con4921]

Similar to Gradle Ex Machina - Devoxx 2019 (20)

PDF
Introduction to Apache Maven
PPTX
Faster Java EE Builds with Gradle
PPTX
Faster Java EE Builds with Gradle
TXT
Gradle notes
 
PDF
6_PDFsam_DevOps.pdf
PPTX
Maven in mulesoft
PPTX
Gradle 2.Write once, builde everywhere
PDF
Intelligent Projects with Maven - DevFest Istanbul
PPTX
Introduction to maven
PPT
Groovy Maven Builds
PPT
An introduction to maven gradle and sbt
PPTX
20091112 - Mars Jug - Apache Maven
PPTX
Gradle.Enemy at the gates
PPTX
The world of gradle - an introduction for developers
PDF
Lightweight Developer Provisioning with Gradle and SEU-as-code
PDF
Lightweight Developer Provisioning with Gradle
PPTX
Maven basics
PDF
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
PPTX
Introduction to Maven
PPT
Using Maven2
Introduction to Apache Maven
Faster Java EE Builds with Gradle
Faster Java EE Builds with Gradle
Gradle notes
 
6_PDFsam_DevOps.pdf
Maven in mulesoft
Gradle 2.Write once, builde everywhere
Intelligent Projects with Maven - DevFest Istanbul
Introduction to maven
Groovy Maven Builds
An introduction to maven gradle and sbt
20091112 - Mars Jug - Apache Maven
Gradle.Enemy at the gates
The world of gradle - an introduction for developers
Lightweight Developer Provisioning with Gradle and SEU-as-code
Lightweight Developer Provisioning with Gradle
Maven basics
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
Introduction to Maven
Using Maven2
Ad

More from Andres Almiray (20)

PDF
Dealing with JSON in the relational world
PDF
Deploying to production with confidence 🚀
PDF
Going beyond ORMs with JSON Relational Duality Views
PDF
Setting up data driven tests with Java tools
PDF
Creando, creciendo, y manteniendo una comunidad de codigo abierto
PDF
Liberando a produccion con confianza
PDF
Liberando a produccion con confidencia
PDF
OracleDB Ecosystem for Java Developers
PDF
Softcon.ph - Maven Puzzlers
PDF
Maven Puzzlers
PDF
Oracle Database Ecosystem for Java Developers
PDF
JReleaser - Releasing at the speed of light
PDF
Building modular applications with the Java Platform Module System and Layrry
PDF
Going Reactive with g rpc
PDF
Building modular applications with JPMS and Layrry
PDF
Taking Micronaut out for a spin
PDF
Apache Groovy's Metaprogramming Options and You
PDF
What I wish I knew about Maven years ago
PDF
What I wish I knew about maven years ago
PDF
The impact of sci fi in tech
Dealing with JSON in the relational world
Deploying to production with confidence 🚀
Going beyond ORMs with JSON Relational Duality Views
Setting up data driven tests with Java tools
Creando, creciendo, y manteniendo una comunidad de codigo abierto
Liberando a produccion con confianza
Liberando a produccion con confidencia
OracleDB Ecosystem for Java Developers
Softcon.ph - Maven Puzzlers
Maven Puzzlers
Oracle Database Ecosystem for Java Developers
JReleaser - Releasing at the speed of light
Building modular applications with the Java Platform Module System and Layrry
Going Reactive with g rpc
Building modular applications with JPMS and Layrry
Taking Micronaut out for a spin
Apache Groovy's Metaprogramming Options and You
What I wish I knew about Maven years ago
What I wish I knew about maven years ago
The impact of sci fi in tech
Ad

Recently uploaded (20)

PPT
Introduction Database Management System for Course Database
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PPTX
Introduction to Artificial Intelligence
PPTX
Online Work Permit System for Fast Permit Processing
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
System and Network Administraation Chapter 3
PPTX
history of c programming in notes for students .pptx
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Nekopoi APK 2025 free lastest update
PDF
AI in Product Development-omnex systems
PDF
Softaken Excel to vCard Converter Software.pdf
Introduction Database Management System for Course Database
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Introduction to Artificial Intelligence
Online Work Permit System for Fast Permit Processing
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Odoo POS Development Services by CandidRoot Solutions
Navsoft: AI-Powered Business Solutions & Custom Software Development
Which alternative to Crystal Reports is best for small or large businesses.pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 41
System and Network Administraation Chapter 3
history of c programming in notes for students .pptx
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
ManageIQ - Sprint 268 Review - Slide Deck
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Operating system designcfffgfgggggggvggggggggg
2025 Textile ERP Trends: SAP, Odoo & Oracle
Nekopoi APK 2025 free lastest update
AI in Product Development-omnex systems
Softaken Excel to vCard Converter Software.pdf

Gradle Ex Machina - Devoxx 2019

  • 1. Gradle Ex Machina Andres Almiray @aalmiray
  • 3. The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, timing, and pricing of any features or functionality described for Oracle’s products may change and remains at the sole discretion of Oracle Corporation. Statements in this presentation relating to Oracle’s future plans, expectations, beliefs, intentions and prospects are “forward-looking statements” and are subject to material risks and uncertainties. A detailed discussion of these factors and other risks that affect our business is contained in Oracle’s Securities and Exchange Commission (SEC) filings, including our most recent reports on Form 10-K and Form 10- Q under the heading “Risk Factors.” These filings are available on the SEC’s website or on Oracle’s website at http://www.oracle.com/investor. All information in this presentation is current as of September 2019 and Oracle undertakes no duty to update any statement in light of new information or future events. Safe Harbor Copyright © 2019 Oracle and/or its affiliates.
  • 5. pom.xml ‱ POM stands for Project Object Model. ‱ A POM file defines both how a project should be built and how consumers may interact with the published artifacts. ‱ Maven delivers lots of features out of the box thanks to the hierarchical nature of the POM. ‱ The Maven Super POM provides default configuration for common plugins such as compiler, resources, surefire, etc. ‱ The strict nature of the structure found in the POM allows anyone to understand the configuration.
  • 7. build.gradle ‱ Gradle build files only specify how projects should be built. ‱ The definition for consumers is delivered through a generated POM file. ‱ Gradle builds are highly customizable, resulting in a wider range of build patterns.
  • 8. Can we have a maven-like structure on top of gradle?
  • 12. The project plugin plugins {‹ id 'org.kordamp.gradle.project' version ‘0.29.0’ }‹ ‹ config {‹ release = (rootProject.findProperty('release') ?: false).toBoolean()‹ ‹ info {‹ name = 'Sample'‹ vendor = 'Acme'‹ description = 'Sample project'‹ ‹ links {‹ website = 'https://github.com/joecool/sample'‹ issueTracker = 'https://github.com/joecool/sample/issues'‹ scm = 'https://github.com/joecool/sample.git'‹ }‹ ‹ people {‹ person {‹ id = 'joecool'‹ name = 'Joe Cool'‹ roles = ['developer']‹ }‹ }‹ } 
 }
  • 13. Provided behavior ‱ The project plugin applies the following plugins org.kordamp.gradle.base org.kordamp.gradle.build-info org.kordamp.gradle.minpom org.kordamp.gradle.jar org.kordamp.gradle.source-jar org.kordamp.gradle.javadoc org.kordamp.gradle.license org.kordamp.gradle.jacoco org.kordamp.gradle.publishing org.kordamp.gradle.testing org.kordamp.gradle.apidoc org.kordamp.gradle.source-stats org.kordamp.gradle.source-html org.kordamp.gradle.bintray
  • 15. Default tasks ‱ Gradle provides the following tasks projects dependencies properties tasks
  • 16. Additional tasks ‱ The base plugin provides the following tasks extensions plugins repositories configurations repositories sourceSets projectProperties effectiveSettings java/groovy/scala compileSettings testSettings publicationSettings
  • 17. Demo
  • 21. Additional plugins ‱ The following plugins can be applied explicitly org.kordamp.gradle.kotlindoc org.kordamp.gradle.scaladoc org.kordamp.gradle.source-xref org.kordamp.gradle.bom org.kordamp.gradle.clirr org.kordamp.gradle.guide org.kordamp.gradle.integration-test org.kordamp.gradle.functional-test
  • 23. The Maven super POM ‱ POMs are hierarchical. ‱ The chain resolves all the way to the top where you find the Maven Super POM. ‱ Super POM configures lots of default & useful behavior.
  • 24. The Gradle super POM ‱ Gradle does not offer this behavior out of the box. ‱ But it can be “faked” using a custom plugin. ‱ The plugin applies the default behavior that consuming projects require.
  • 27. Standard (gradle) . ├── build.gradle ├── guide │   └── build.gradle ├── project1 │   └── build.gradle ├── project2 │   └── build.gradle └── settings.gradle . ├── build.gradle ├── guide │   └── guide.gradle ├── project1 │   └── project1.gradle ├── project2 │   └── project2.gradle └── settings.gradle
  • 28. Standard (gradle) $ cat settings.gradle include 'guide' include 'project1' include 'project2' $ cat settings.gradle include 'guide' include 'project1' include 'project2’ project(':guide').buildFileName = 'guide.gradle' project(':project1').buildFileName = 'project1.gradle' project(':project2').buildFileName = 'project2.gradle'
  • 29. Standard (gradle) $ cat settings.gradle buildscript {‹ repositories {‹ gradlePluginPortal()‹ }‹ dependencies {‹ classpath 'org.kordamp.gradle:settings-gradle-plugin:0.29.0‹ }‹ } ‹ apply plugin: 'org.kordamp.gradle.settings'‹ ‹ projects {‹ layout = 'standard'‹ }
  • 30. Two-level (gradle) . ├── build.gradle ├── docs │   └── guide │       └── build.gradle └── subprojects     ├── project1     │   └── build.gradle     └── project2         └── build.gradle . ├── build.gradle ├── docs │   └── guide │       └── guide.gradle └── subprojects     ├── project1     │   └── project1.gradle     └── project2         └── project2.gradle
  • 31. Two-level (gradle) $ cat settings.gradle include 'guide' include 'project1' include 'project2' project(':guide').projectDir = new File(“$settingsDir/docs/guide”) project(':project1').projectDir = new File(“$settingsDir/subprojects/project1”) project(':project2').projectDir = new File(“$settingsDir/subprojects/project2”) // update names if required project(':guide').buildFileName = 'guide.gradle' project(':project1').buildFileName = 'project1.gradle' project(':project2').buildFileName = 'project2.gradle'
  • 32. Two-level (gradle) $ cat settings.gradle buildscript {‹ repositories {‹ gradlePluginPortal()‹ }‹ dependencies {‹ classpath 'org.kordamp.gradle:settings-gradle-plugin:0.29.0‹ }‹ } ‹ apply plugin: 'org.kordamp.gradle.settings'‹ ‹ projects {‹ layout = 'two-level' directories = ['docs', 'subprojects']‹ }
  • 33. Multi-level (gradle) . ├── build.gradle ├── guide │   └── build.gradle └── subprojects     ├── project1     │   └── build.gradle     └── project2         └── build.gradle . ├── build.gradle ├── guide │   └── guide.gradle └── subprojects     ├── project1     │   └── project1.gradle     └── project2         └── project2.gradle
  • 34. Multi-level (gradle) $ cat settings.gradle buildscript {‹ repositories {‹ gradlePluginPortal()‹ }‹ dependencies {‹ classpath 'org.kordamp.gradle:settings-gradle-plugin:0.29.0‹ }‹ } ‹ apply plugin: 'org.kordamp.gradle.settings'‹ ‹ projects {‹ layout = 'multi-level'‹ directories = [‹ 'guide',‹ 'subprojects/project1',‹ 'subprojects/project2'‹ ]‹ }