SlideShare une entreprise Scribd logo
1  sur  41
Télécharger pour lire hors ligne
ANDRES ALMIRAY
@AALMIRAY
MAKING THE MOST OF
YOUR GRADLE BUILD
1
HOW TO GET GRADLE
INSTALLED ON YOUR
SYSTEM
$ curl -s get.sdkman.io | bash
$ sdk install gradle
2
INITIALIZING A GRADLE
PROJECT
GRADLE INIT
THIS COMMAND WILL GENERATE A BASIC STRUCTURE
AND A MINIMUM SET OF FILES TO GET STARTED.
YOU CAN INVOKE THIS COMMAND ON A MAVEN PROJECT
TO TURN IT INTO A GRADLE PROJECT. MUST MIGRATE
PLUGINS MANUALLY.
$ sdk install lazybones
$ lazybones create gradle-quickstart
sample
3
FIX GRADLE VERSION TO A
PARTICULAR RELEASE
GRADLE WRAPPER
INITIALIZE THE WRAPPER WITH A GIVEN VERSION.
CHANGE FROM –bin.zip TO –all.zip TO HAVE ACCESS TO
GRADLE API SOURCES.
4
INVOKING GRADLE
ANYWHERE ON YOUR
PROJECT
GDUB
https://github.com/dougborg/gdub
A SCRIPT THAT CAN INVOKE A GRADLE BUILD ANYWHERE
INSIDE THE PROJECT STRUCTURE.
WILL ATTEMPT RESOLVING WRAPPER FIRST, THEN LOCAL
GRADLE.
FAILS IF NEITHER IS FOUND.
5
COMMAND TARGET
EXPANSION
TYPE LESS, DO MORE
THE GRADLE COMMAND LINE CAN EXPAND COMMAND
TARGETS IF YOU GIVE IT ENOUGH INFORMATION
$ gradle publishToMavenLocal
$ gradle puTML
6
MULTI-PROJECT SETUP
CHANGE BUILD FILE NAMES
CHANGE BULD FILE NAME FROM BUILD.GRADLE TO
${project.name}.gradle
USE GROOVY EXPRESSIONS TO FACTORIZE PROJECT
INCLUSIONS IN settings.gradle
SETTINGS.GRADLE (1/2)
['common',	
  'full',	
  'light'].each	
  {	
  name	
  -­‐>	
  
	
  	
  	
  	
  File	
  subdir	
  =	
  new	
  File(rootDir,	
  name)	
  
	
  	
  	
  	
  subdir.eachDir	
  {	
  dir	
  -­‐>	
  
	
  	
  	
  	
  	
  	
  	
  	
  File	
  buildFile	
  =	
  new	
  File(dir,	
  "${dir.name}.gradle")	
  
	
  	
  	
  	
  	
  	
  	
  	
  if	
  (buildFile.exists())	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  include	
  "${name}/${dir.name}"	
  
	
  	
  	
  	
  	
  	
  	
  	
  }	
  
	
  	
  	
  	
  }	
  
}	
  
SETTINGS.GRADLE (2/2)
rootProject.name	
  =	
  'my-­‐project'	
  
rootProject.children.each	
  {	
  project	
  -­‐>	
  
	
  	
  	
  	
  int	
  slash	
  =	
  project.name.indexOf('/')	
  
	
  	
  	
  	
  String	
  fileBaseName	
  =	
  project.name[(slash	
  +	
  1)..-­‐1]	
  
	
  	
  	
  	
  String	
  projectDirName	
  =	
  project.name	
  
	
  	
  	
  	
  project.name	
  =	
  fileBaseName	
  
	
  	
  	
  	
  project.projectDir	
  =	
  new	
  File(settingsDir,	
  projectDirName)	
  
	
  	
  	
  	
  project.buildFileName	
  =	
  "${fileBaseName}.gradle"	
  
	
  	
  	
  	
  assert	
  project.projectDir.isDirectory()	
  
	
  	
  	
  	
  assert	
  project.buildFile.isFile()	
  
}	
  
7
BUILD FILE ETIQUETTE
WHAT BUILD.GRADLE IS NOT
KEEP IT DRY
EMBRACE THE POWER OF CONVENTIONS.
BUILD FILE SHOULD DEFINE HOW THE PROJECT DEVIATES
FROM THE PRE-ESTABLISHED CONVENTIONS.
RELY ON SECONDARY SCRIPTS, SEGGREGATED BY
RESPONSIBILITIES.
TASK DEFINITIONS
PUT THEM IN SEPARATE FILES.
1.  INSIDE SECONDARY SCRIPTS
1.  REGULAR TASK DEFINITIONS
2.  PLUGIN DEFINITIONS
2.  AS PART OF buildSrc SOURCES
3.  AS A PLUGIN PROJECT
PLUGINS
USE THE PLUGINS BLOCK DSL IF IN A SINGLE PROJECT.
PLUGINS BLOCK DOES NOT WORK IN SECONDARY
SCRIPTS.
USE THE OLD-SCHOOL SYNTAX IF IN A MULTI-PROJECT
AND NOT ALL SUBPROJECTS REQUIRE THE SAME
PLUGINS.
8
DON’T REINVENT THE
WHEEL, APPLY PLUGINS
INSTEAD
USEFUL PLUGINS
Versions
id 'com.github.ben-manes.versions' version '0.13.0’
License
id 'com.github.hierynomus.license' version '0.11.0’
Versioning
id 'net.nemerosa.versioning' version '2.4.0'
9
SUPPLY MORE INFORMATION
TO DEVELOPERS
MANIFEST ENTRIES
ENRICH JAR MANIFESTS WITH ADDITIONAL ENTRIES SUCH AS
'Built-By': System.properties['user.name'],
'Created-By': "${System.properties['java.version']} (${System.properties['java.vendor']}
${System.properties['java.vm.version']})".toString(),
'Build-Date': buildDate,
'Build-Time': buildTime,
'Build-Revision': versioning.info.commit,
'Specification-Title': project.name,
'Specification-Version': project.version,
'Specification-Vendor': project.vendor,
'Implementation-Title': project.name,
'Implementation-Version': project.version,
'Implementation-Vendor': project.vendor
10
INCREMENTAL BUILDS
INCREMENTAL BUILD
ACTIVATED BY ADDING –t TO THE COMMAND LINE.
EXECUTES A GIVEN COMMAND WHENEVER ITS
RESOURCES (INPUTS) CHANGE.
AVOID INVOKING THE CLEAN TASK AS MUCH AS YOU CAN.
11
AGGREGATE CODE
COVERAGE REPORTS
JACOCO OR BUST
STEP 1: DEFINE A LIST OF PROJECTS TO INCLUDE
ext	
  {	
  
	
  	
  	
  	
  projectsWithCoverage	
  =	
  []	
  
	
  	
  	
  	
  baseJaCocoDir	
  =	
  "${buildDir}/reports/jacoco/test/"	
  
	
  	
  	
  	
  jacocoMergeExecFile	
  =	
  "${baseJaCocoDir	
  }jacocoTestReport.exec"	
  
	
  	
  	
  	
  jacocoMergeReportHTMLFile	
  =	
  "${baseJaCocoDir	
  }/html/"	
  
	
  	
  	
  	
  jacocoMergeReportXMLFile	
  =	
  "${baseJaCocoDir}/jacocoTestReport.xml"	
  
}	
  
JACOCO OR BUST
STEP 2: ADD PROJECT TO COVERAGE LIST
jacocoTestReport	
  {	
  
	
  	
  	
  	
  group	
  =	
  'Reporting'	
  
	
  	
  	
  	
  description	
  =	
  'Generate	
  Jacoco	
  coverage	
  reports	
  after	
  running	
  tests.'	
  
	
  	
  	
  	
  additionalSourceDirs	
  =	
  project.files(sourceSets.main.allSource.srcDirs)	
  
	
  	
  	
  	
  sourceDirectories	
  =	
  project.files(sourceSets.main.allSource.srcDirs)	
  
	
  	
  	
  	
  classDirectories	
  =	
  project.files(sourceSets.main.output)	
  
	
  	
  	
  	
  reports	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  xml.enabled	
  =	
  true	
  
	
  	
  	
  	
  	
  	
  	
  	
  csv.enabled	
  =	
  false	
  
	
  	
  	
  	
  	
  	
  	
  	
  html.enabled	
  =	
  true	
  
	
  	
  	
  	
  }	
  
}	
  
projectsWithCoverage	
  <<	
  project	
  
JACOCO OR BUST
STEP 3: DEFINE AGGREGATE TASKS IN ROOT PROJECT
evaluationDependsOnChildren()	
  //	
  VERY	
  IMPORTANT!!	
  
	
  
task	
  jacocoRootMerge(type:	
  org.gradle.testing.jacoco.tasks.JacocoMerge)	
  {	
  
	
  	
  	
  	
  dependsOn	
  =	
  projectsWithCoverage.test	
  +	
  
projectsWithCoverage.jacocoTestReport	
  	
  
	
  	
  	
  	
  executionData	
  =	
  projectsWithCoverage.jacocoTestReport.executionData	
  
	
  	
  	
  	
  destinationFile	
  =	
  file(jacocoMergeExecFile)	
  
}	
  
JACOCO OR BUST
STEP 3: DEFINE AGGREGATE TASKS IN ROOT PROJECT
task	
  jacocoRootMergeReport(dependsOn:	
  jacocoRootMerge,	
  type:	
  JacocoReport)	
  {	
  
	
  	
  	
  	
  executionData	
  projectsWithCoverage.jacocoTestReport.executionData	
  
	
  	
  	
  	
  sourceDirectories	
  =	
  projectsWithCoverage.sourceSets.main.allSource.srcDirs	
  
	
  	
  	
  	
  classDirectories	
  =	
  projectsWithCoverage.sourceSets.main.output	
  
	
  
	
  	
  	
  	
  reports	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  html.enabled	
  =	
  true	
  
	
  	
  	
  	
  	
  	
  	
  	
  xml.enabled	
  =	
  true	
  
	
  	
  	
  	
  	
  	
  	
  	
  html.destination	
  =	
  file(jacocoMergeReportHTMLFile)	
  
	
  	
  	
  	
  	
  	
  	
  	
  xml.destination	
  =	
  file(jacocoMergeReportXMLFile)	
  
	
  	
  	
  	
  }	
  
}	
  
11
PLUGINS! PLUGINS!
PLUGINS!
license
versions
stats
bintray
shadow
izpack
java2html
git
coveralls
asciidoctor
jbake
markdown
livereload
gretty
nexus
watch
wuff
spawn
versioning
pitest
build-time-tracker
semantic-release
clirr
japicmp
compass
flyway
jmh
macappbundle
osspackage
jnlp
spotless
dependency-
management
sshoogr
12
THE DAILY GRADLE TIP
@DAILYGRADLE
USEFUL TIPS POSTED EVERY WORKING DAY AT 5PM GMT.
	
  
FROM THE SAME PERSON THAT BROUGHT YOU
“IDIOMATIC GRADLE”
@YSB33R
THANK YOU!
ANDRES ALMIRAY
@AALMIRAY

Contenu connexe

Tendances

The world of gradle - an introduction for developers
The world of gradle  - an introduction for developersThe world of gradle  - an introduction for developers
The world of gradle - an introduction for developersTricode (part of Dept)
 
Java(ee) mongo db applications in the cloud
Java(ee) mongo db applications in the cloud Java(ee) mongo db applications in the cloud
Java(ee) mongo db applications in the cloud Shekhar Gulati
 
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech TalkContract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech TalkRed Hat Developers
 
SymfonyCon Berlin 2016 Jenkins Deployment Pipelines
SymfonyCon Berlin 2016 Jenkins Deployment PipelinesSymfonyCon Berlin 2016 Jenkins Deployment Pipelines
SymfonyCon Berlin 2016 Jenkins Deployment Pipelinescpsitgmbh
 
Retrofit
RetrofitRetrofit
Retrofitbresiu
 
Gradle - time for a new build
Gradle - time for a new buildGradle - time for a new build
Gradle - time for a new buildIgor Khotin
 
Java EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSFJava EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSFJiayun Zhou
 
Building domain-specific testing tools : lessons learned from the Apache Slin...
Building domain-specific testing tools : lessons learned from the Apache Slin...Building domain-specific testing tools : lessons learned from the Apache Slin...
Building domain-specific testing tools : lessons learned from the Apache Slin...Robert Munteanu
 
Managing user's data with Spring Session
Managing user's data with Spring SessionManaging user's data with Spring Session
Managing user's data with Spring SessionDavid Gómez García
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot IntroductionJeevesh Pandey
 
Spring Boot and REST API
Spring Boot and REST APISpring Boot and REST API
Spring Boot and REST API07.pallav
 
Gradle - the Enterprise Automation Tool
Gradle  - the Enterprise Automation ToolGradle  - the Enterprise Automation Tool
Gradle - the Enterprise Automation ToolIzzet Mustafaiev
 
BOSH / CF Deployment in modern ways #cf_tokyo
BOSH / CF Deployment in modern ways #cf_tokyoBOSH / CF Deployment in modern ways #cf_tokyo
BOSH / CF Deployment in modern ways #cf_tokyoToshiaki Maki
 
手把手教你如何串接 Log 到各種網路服務
手把手教你如何串接 Log 到各種網路服務手把手教你如何串接 Log 到各種網路服務
手把手教你如何串接 Log 到各種網路服務Mu Chun Wang
 
Cool Jvm Tools to Help you Test - Aylesbury Testers Version
Cool Jvm Tools to Help you Test - Aylesbury Testers VersionCool Jvm Tools to Help you Test - Aylesbury Testers Version
Cool Jvm Tools to Help you Test - Aylesbury Testers VersionSchalk Cronjé
 
Building Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And TricksBuilding Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And TricksMike Hugo
 

Tendances (20)

Springを用いた社内ライブラリ開発
Springを用いた社内ライブラリ開発Springを用いた社内ライブラリ開発
Springを用いた社内ライブラリ開発
 
The world of gradle - an introduction for developers
The world of gradle  - an introduction for developersThe world of gradle  - an introduction for developers
The world of gradle - an introduction for developers
 
Java(ee) mongo db applications in the cloud
Java(ee) mongo db applications in the cloud Java(ee) mongo db applications in the cloud
Java(ee) mongo db applications in the cloud
 
Android Libs - Retrofit
Android Libs - RetrofitAndroid Libs - Retrofit
Android Libs - Retrofit
 
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech TalkContract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
 
SymfonyCon Berlin 2016 Jenkins Deployment Pipelines
SymfonyCon Berlin 2016 Jenkins Deployment PipelinesSymfonyCon Berlin 2016 Jenkins Deployment Pipelines
SymfonyCon Berlin 2016 Jenkins Deployment Pipelines
 
Retrofit
RetrofitRetrofit
Retrofit
 
Gradle Introduction
Gradle IntroductionGradle Introduction
Gradle Introduction
 
Gradle - time for a new build
Gradle - time for a new buildGradle - time for a new build
Gradle - time for a new build
 
Java EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSFJava EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSF
 
Building domain-specific testing tools : lessons learned from the Apache Slin...
Building domain-specific testing tools : lessons learned from the Apache Slin...Building domain-specific testing tools : lessons learned from the Apache Slin...
Building domain-specific testing tools : lessons learned from the Apache Slin...
 
Managing user's data with Spring Session
Managing user's data with Spring SessionManaging user's data with Spring Session
Managing user's data with Spring Session
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
 
Spring Boot and REST API
Spring Boot and REST APISpring Boot and REST API
Spring Boot and REST API
 
Gradle - the Enterprise Automation Tool
Gradle  - the Enterprise Automation ToolGradle  - the Enterprise Automation Tool
Gradle - the Enterprise Automation Tool
 
Retrofit
RetrofitRetrofit
Retrofit
 
BOSH / CF Deployment in modern ways #cf_tokyo
BOSH / CF Deployment in modern ways #cf_tokyoBOSH / CF Deployment in modern ways #cf_tokyo
BOSH / CF Deployment in modern ways #cf_tokyo
 
手把手教你如何串接 Log 到各種網路服務
手把手教你如何串接 Log 到各種網路服務手把手教你如何串接 Log 到各種網路服務
手把手教你如何串接 Log 到各種網路服務
 
Cool Jvm Tools to Help you Test - Aylesbury Testers Version
Cool Jvm Tools to Help you Test - Aylesbury Testers VersionCool Jvm Tools to Help you Test - Aylesbury Testers Version
Cool Jvm Tools to Help you Test - Aylesbury Testers Version
 
Building Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And TricksBuilding Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And Tricks
 

En vedette

Gradle Glam: Plugis Galore
Gradle Glam: Plugis GaloreGradle Glam: Plugis Galore
Gradle Glam: Plugis GaloreAndres Almiray
 
Griffon: what's new and what's coming
Griffon: what's new and what's comingGriffon: what's new and what's coming
Griffon: what's new and what's comingAndres Almiray
 
Gradle Glam: Plugis Strike Back
Gradle Glam: Plugis Strike BackGradle Glam: Plugis Strike Back
Gradle Glam: Plugis Strike BackAndres Almiray
 
Greach - The Groovy Ecosystem
Greach - The Groovy EcosystemGreach - The Groovy Ecosystem
Greach - The Groovy EcosystemAndres Almiray
 
Gr8conf - The Groovy Ecosystem Revisited
Gr8conf - The Groovy Ecosystem RevisitedGr8conf - The Groovy Ecosystem Revisited
Gr8conf - The Groovy Ecosystem RevisitedAndres Almiray
 
Asciidoctor, because documentation does not have to suck
Asciidoctor, because documentation does not have to suckAsciidoctor, because documentation does not have to suck
Asciidoctor, because documentation does not have to suckAndres Almiray
 
Machine Learning for Developers
Machine Learning for DevelopersMachine Learning for Developers
Machine Learning for DevelopersDanilo Poccia
 
Get Value from Your Data
Get Value from Your DataGet Value from Your Data
Get Value from Your DataDanilo Poccia
 
Laziness, trampolines, monoids and other functional amenities: this is not yo...
Laziness, trampolines, monoids and other functional amenities: this is not yo...Laziness, trampolines, monoids and other functional amenities: this is not yo...
Laziness, trampolines, monoids and other functional amenities: this is not yo...Mario Fusco
 
vJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemvJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemAndres Almiray
 
Real World Event Sourcing and CQRS
Real World Event Sourcing and CQRSReal World Event Sourcing and CQRS
Real World Event Sourcing and CQRSMatthew Hawkins
 
Gradle: Harder, Stronger, Better, Faster
Gradle: Harder, Stronger, Better, FasterGradle: Harder, Stronger, Better, Faster
Gradle: Harder, Stronger, Better, FasterAndres Almiray
 
Developing microservices with aggregates (devnexus2017)
Developing microservices with aggregates (devnexus2017)Developing microservices with aggregates (devnexus2017)
Developing microservices with aggregates (devnexus2017)Chris Richardson
 
There is no such thing as a microservice! (oracle code nyc)
There is no such thing as a microservice! (oracle code nyc)There is no such thing as a microservice! (oracle code nyc)
There is no such thing as a microservice! (oracle code nyc)Chris Richardson
 
Developing event-driven microservices with event sourcing and CQRS (svcc, sv...
Developing event-driven microservices with event sourcing and CQRS  (svcc, sv...Developing event-driven microservices with event sourcing and CQRS  (svcc, sv...
Developing event-driven microservices with event sourcing and CQRS (svcc, sv...Chris Richardson
 

En vedette (15)

Gradle Glam: Plugis Galore
Gradle Glam: Plugis GaloreGradle Glam: Plugis Galore
Gradle Glam: Plugis Galore
 
Griffon: what's new and what's coming
Griffon: what's new and what's comingGriffon: what's new and what's coming
Griffon: what's new and what's coming
 
Gradle Glam: Plugis Strike Back
Gradle Glam: Plugis Strike BackGradle Glam: Plugis Strike Back
Gradle Glam: Plugis Strike Back
 
Greach - The Groovy Ecosystem
Greach - The Groovy EcosystemGreach - The Groovy Ecosystem
Greach - The Groovy Ecosystem
 
Gr8conf - The Groovy Ecosystem Revisited
Gr8conf - The Groovy Ecosystem RevisitedGr8conf - The Groovy Ecosystem Revisited
Gr8conf - The Groovy Ecosystem Revisited
 
Asciidoctor, because documentation does not have to suck
Asciidoctor, because documentation does not have to suckAsciidoctor, because documentation does not have to suck
Asciidoctor, because documentation does not have to suck
 
Machine Learning for Developers
Machine Learning for DevelopersMachine Learning for Developers
Machine Learning for Developers
 
Get Value from Your Data
Get Value from Your DataGet Value from Your Data
Get Value from Your Data
 
Laziness, trampolines, monoids and other functional amenities: this is not yo...
Laziness, trampolines, monoids and other functional amenities: this is not yo...Laziness, trampolines, monoids and other functional amenities: this is not yo...
Laziness, trampolines, monoids and other functional amenities: this is not yo...
 
vJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemvJUG - The JavaFX Ecosystem
vJUG - The JavaFX Ecosystem
 
Real World Event Sourcing and CQRS
Real World Event Sourcing and CQRSReal World Event Sourcing and CQRS
Real World Event Sourcing and CQRS
 
Gradle: Harder, Stronger, Better, Faster
Gradle: Harder, Stronger, Better, FasterGradle: Harder, Stronger, Better, Faster
Gradle: Harder, Stronger, Better, Faster
 
Developing microservices with aggregates (devnexus2017)
Developing microservices with aggregates (devnexus2017)Developing microservices with aggregates (devnexus2017)
Developing microservices with aggregates (devnexus2017)
 
There is no such thing as a microservice! (oracle code nyc)
There is no such thing as a microservice! (oracle code nyc)There is no such thing as a microservice! (oracle code nyc)
There is no such thing as a microservice! (oracle code nyc)
 
Developing event-driven microservices with event sourcing and CQRS (svcc, sv...
Developing event-driven microservices with event sourcing and CQRS  (svcc, sv...Developing event-driven microservices with event sourcing and CQRS  (svcc, sv...
Developing event-driven microservices with event sourcing and CQRS (svcc, sv...
 

Similaire à Making the Most of Your Gradle Build

Making the most of your gradle build - Gr8Conf 2017
Making the most of your gradle build - Gr8Conf 2017Making the most of your gradle build - Gr8Conf 2017
Making the most of your gradle build - Gr8Conf 2017Andres Almiray
 
Making the most of your gradle build - Greach 2017
Making the most of your gradle build - Greach 2017Making the most of your gradle build - Greach 2017
Making the most of your gradle build - Greach 2017Andres Almiray
 
Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingIdiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingSchalk Cronjé
 
Idiomatic gradle plugin writing
Idiomatic gradle plugin writingIdiomatic gradle plugin writing
Idiomatic gradle plugin writingSchalk Cronjé
 
Basic Gradle Plugin Writing
Basic Gradle Plugin WritingBasic Gradle Plugin Writing
Basic Gradle Plugin WritingSchalk Cronjé
 
Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingIdiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingSchalk Cronjé
 
Gradleintroduction 111010130329-phpapp01
Gradleintroduction 111010130329-phpapp01Gradleintroduction 111010130329-phpapp01
Gradleintroduction 111010130329-phpapp01Tino Isnich
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with GradleRyan Cuprak
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with GradleRyan Cuprak
 
Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingIdiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingSchalk Cronjé
 
Andres Almiray - Gradle Ex Machina - Codemotion Rome 2019
Andres Almiray - Gradle Ex Machina - Codemotion Rome 2019Andres Almiray - Gradle Ex Machina - Codemotion Rome 2019
Andres Almiray - Gradle Ex Machina - Codemotion Rome 2019Codemotion
 
Mastering Grails 3 Plugins - G3 Summit 2016
Mastering Grails 3 Plugins - G3 Summit 2016Mastering Grails 3 Plugins - G3 Summit 2016
Mastering Grails 3 Plugins - G3 Summit 2016Alvaro Sanchez-Mariscal
 
Gradle plugin, take control of the build
Gradle plugin, take control of the buildGradle plugin, take control of the build
Gradle plugin, take control of the buildEyal Lezmy
 
Anatomy of a Gradle plugin
Anatomy of a Gradle pluginAnatomy of a Gradle plugin
Anatomy of a Gradle pluginDmytro Zaitsev
 
Faster java ee builds with gradle [con4921]
Faster java ee builds with gradle [con4921]Faster java ee builds with gradle [con4921]
Faster java ee builds with gradle [con4921]Ryan Cuprak
 
10 Cool Facts about Gradle
10 Cool Facts about Gradle10 Cool Facts about Gradle
10 Cool Facts about GradleEvgeny Goldin
 
Making the most of your gradle build - vJUG24 2017
Making the most of your gradle build - vJUG24 2017Making the most of your gradle build - vJUG24 2017
Making the most of your gradle build - vJUG24 2017Andres Almiray
 

Similaire à Making the Most of Your Gradle Build (20)

Making the most of your gradle build - Gr8Conf 2017
Making the most of your gradle build - Gr8Conf 2017Making the most of your gradle build - Gr8Conf 2017
Making the most of your gradle build - Gr8Conf 2017
 
Making the most of your gradle build - Greach 2017
Making the most of your gradle build - Greach 2017Making the most of your gradle build - Greach 2017
Making the most of your gradle build - Greach 2017
 
Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingIdiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin Writing
 
GradleFX
GradleFXGradleFX
GradleFX
 
Idiomatic gradle plugin writing
Idiomatic gradle plugin writingIdiomatic gradle plugin writing
Idiomatic gradle plugin writing
 
Basic Gradle Plugin Writing
Basic Gradle Plugin WritingBasic Gradle Plugin Writing
Basic Gradle Plugin Writing
 
Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingIdiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin Writing
 
Gradleintroduction 111010130329-phpapp01
Gradleintroduction 111010130329-phpapp01Gradleintroduction 111010130329-phpapp01
Gradleintroduction 111010130329-phpapp01
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with Gradle
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with Gradle
 
Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingIdiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin Writing
 
Andres Almiray - Gradle Ex Machina - Codemotion Rome 2019
Andres Almiray - Gradle Ex Machina - Codemotion Rome 2019Andres Almiray - Gradle Ex Machina - Codemotion Rome 2019
Andres Almiray - Gradle Ex Machina - Codemotion Rome 2019
 
Gradle ex-machina
Gradle ex-machinaGradle ex-machina
Gradle ex-machina
 
Gradle how to's
Gradle how to'sGradle how to's
Gradle how to's
 
Mastering Grails 3 Plugins - G3 Summit 2016
Mastering Grails 3 Plugins - G3 Summit 2016Mastering Grails 3 Plugins - G3 Summit 2016
Mastering Grails 3 Plugins - G3 Summit 2016
 
Gradle plugin, take control of the build
Gradle plugin, take control of the buildGradle plugin, take control of the build
Gradle plugin, take control of the build
 
Anatomy of a Gradle plugin
Anatomy of a Gradle pluginAnatomy of a Gradle plugin
Anatomy of a Gradle plugin
 
Faster java ee builds with gradle [con4921]
Faster java ee builds with gradle [con4921]Faster java ee builds with gradle [con4921]
Faster java ee builds with gradle [con4921]
 
10 Cool Facts about Gradle
10 Cool Facts about Gradle10 Cool Facts about Gradle
10 Cool Facts about Gradle
 
Making the most of your gradle build - vJUG24 2017
Making the most of your gradle build - vJUG24 2017Making the most of your gradle build - vJUG24 2017
Making the most of your gradle build - vJUG24 2017
 

Plus de Andres Almiray

Creando, creciendo, y manteniendo una comunidad de codigo abierto
Creando, creciendo, y manteniendo una comunidad de codigo abiertoCreando, creciendo, y manteniendo una comunidad de codigo abierto
Creando, creciendo, y manteniendo una comunidad de codigo abiertoAndres Almiray
 
Liberando a produccion con confianza
Liberando a produccion con confianzaLiberando a produccion con confianza
Liberando a produccion con confianzaAndres Almiray
 
Liberando a produccion con confidencia
Liberando a produccion con confidenciaLiberando a produccion con confidencia
Liberando a produccion con confidenciaAndres Almiray
 
OracleDB Ecosystem for Java Developers
OracleDB Ecosystem for Java DevelopersOracleDB Ecosystem for Java Developers
OracleDB Ecosystem for Java DevelopersAndres Almiray
 
Softcon.ph - Maven Puzzlers
Softcon.ph - Maven PuzzlersSoftcon.ph - Maven Puzzlers
Softcon.ph - Maven PuzzlersAndres Almiray
 
Oracle Database Ecosystem for Java Developers
Oracle Database Ecosystem for Java DevelopersOracle Database Ecosystem for Java Developers
Oracle Database Ecosystem for Java DevelopersAndres Almiray
 
JReleaser - Releasing at the speed of light
JReleaser - Releasing at the speed of lightJReleaser - Releasing at the speed of light
JReleaser - Releasing at the speed of lightAndres Almiray
 
Building modular applications with the Java Platform Module System and Layrry
Building modular applications with the Java Platform Module System and LayrryBuilding modular applications with the Java Platform Module System and Layrry
Building modular applications with the Java Platform Module System and LayrryAndres Almiray
 
Going Reactive with g rpc
Going Reactive with g rpcGoing Reactive with g rpc
Going Reactive with g rpcAndres Almiray
 
Building modular applications with JPMS and Layrry
Building modular applications with JPMS and LayrryBuilding modular applications with JPMS and Layrry
Building modular applications with JPMS and LayrryAndres Almiray
 
Taking Micronaut out for a spin
Taking Micronaut out for a spinTaking Micronaut out for a spin
Taking Micronaut out for a spinAndres Almiray
 
Apache Groovy's Metaprogramming Options and You
Apache Groovy's Metaprogramming Options and YouApache Groovy's Metaprogramming Options and You
Apache Groovy's Metaprogramming Options and YouAndres Almiray
 
What I wish I knew about Maven years ago
What I wish I knew about Maven years agoWhat I wish I knew about Maven years ago
What I wish I knew about Maven years agoAndres Almiray
 
What I wish I knew about maven years ago
What I wish I knew about maven years agoWhat I wish I knew about maven years ago
What I wish I knew about maven years agoAndres Almiray
 
The impact of sci fi in tech
The impact of sci fi in techThe impact of sci fi in tech
The impact of sci fi in techAndres Almiray
 
Gradle Ex Machina - Devoxx 2019
Gradle Ex Machina - Devoxx 2019Gradle Ex Machina - Devoxx 2019
Gradle Ex Machina - Devoxx 2019Andres Almiray
 
Creating Better Builds with Gradle
Creating Better Builds with GradleCreating Better Builds with Gradle
Creating Better Builds with GradleAndres Almiray
 
Interacting with the Oracle Cloud Java SDK with Gradle
Interacting with the Oracle Cloud Java SDK with GradleInteracting with the Oracle Cloud Java SDK with Gradle
Interacting with the Oracle Cloud Java SDK with GradleAndres Almiray
 

Plus de Andres Almiray (20)

Creando, creciendo, y manteniendo una comunidad de codigo abierto
Creando, creciendo, y manteniendo una comunidad de codigo abiertoCreando, creciendo, y manteniendo una comunidad de codigo abierto
Creando, creciendo, y manteniendo una comunidad de codigo abierto
 
Liberando a produccion con confianza
Liberando a produccion con confianzaLiberando a produccion con confianza
Liberando a produccion con confianza
 
Liberando a produccion con confidencia
Liberando a produccion con confidenciaLiberando a produccion con confidencia
Liberando a produccion con confidencia
 
OracleDB Ecosystem for Java Developers
OracleDB Ecosystem for Java DevelopersOracleDB Ecosystem for Java Developers
OracleDB Ecosystem for Java Developers
 
Softcon.ph - Maven Puzzlers
Softcon.ph - Maven PuzzlersSoftcon.ph - Maven Puzzlers
Softcon.ph - Maven Puzzlers
 
Maven Puzzlers
Maven PuzzlersMaven Puzzlers
Maven Puzzlers
 
Oracle Database Ecosystem for Java Developers
Oracle Database Ecosystem for Java DevelopersOracle Database Ecosystem for Java Developers
Oracle Database Ecosystem for Java Developers
 
JReleaser - Releasing at the speed of light
JReleaser - Releasing at the speed of lightJReleaser - Releasing at the speed of light
JReleaser - Releasing at the speed of light
 
Building modular applications with the Java Platform Module System and Layrry
Building modular applications with the Java Platform Module System and LayrryBuilding modular applications with the Java Platform Module System and Layrry
Building modular applications with the Java Platform Module System and Layrry
 
Going Reactive with g rpc
Going Reactive with g rpcGoing Reactive with g rpc
Going Reactive with g rpc
 
Building modular applications with JPMS and Layrry
Building modular applications with JPMS and LayrryBuilding modular applications with JPMS and Layrry
Building modular applications with JPMS and Layrry
 
Taking Micronaut out for a spin
Taking Micronaut out for a spinTaking Micronaut out for a spin
Taking Micronaut out for a spin
 
Apache Groovy's Metaprogramming Options and You
Apache Groovy's Metaprogramming Options and YouApache Groovy's Metaprogramming Options and You
Apache Groovy's Metaprogramming Options and You
 
What I wish I knew about Maven years ago
What I wish I knew about Maven years agoWhat I wish I knew about Maven years ago
What I wish I knew about Maven years ago
 
What I wish I knew about maven years ago
What I wish I knew about maven years agoWhat I wish I knew about maven years ago
What I wish I knew about maven years ago
 
The impact of sci fi in tech
The impact of sci fi in techThe impact of sci fi in tech
The impact of sci fi in tech
 
Gradle Ex Machina - Devoxx 2019
Gradle Ex Machina - Devoxx 2019Gradle Ex Machina - Devoxx 2019
Gradle Ex Machina - Devoxx 2019
 
Creating Better Builds with Gradle
Creating Better Builds with GradleCreating Better Builds with Gradle
Creating Better Builds with Gradle
 
Interacting with the Oracle Cloud Java SDK with Gradle
Interacting with the Oracle Cloud Java SDK with GradleInteracting with the Oracle Cloud Java SDK with Gradle
Interacting with the Oracle Cloud Java SDK with Gradle
 
Go Java, Go!
Go Java, Go!Go Java, Go!
Go Java, Go!
 

Dernier

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 

Dernier (20)

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 

Making the Most of Your Gradle Build

  • 1. ANDRES ALMIRAY @AALMIRAY MAKING THE MOST OF YOUR GRADLE BUILD
  • 2.
  • 3.
  • 4. 1 HOW TO GET GRADLE INSTALLED ON YOUR SYSTEM
  • 5. $ curl -s get.sdkman.io | bash $ sdk install gradle
  • 7. GRADLE INIT THIS COMMAND WILL GENERATE A BASIC STRUCTURE AND A MINIMUM SET OF FILES TO GET STARTED. YOU CAN INVOKE THIS COMMAND ON A MAVEN PROJECT TO TURN IT INTO A GRADLE PROJECT. MUST MIGRATE PLUGINS MANUALLY.
  • 8. $ sdk install lazybones $ lazybones create gradle-quickstart sample
  • 9. 3 FIX GRADLE VERSION TO A PARTICULAR RELEASE
  • 10. GRADLE WRAPPER INITIALIZE THE WRAPPER WITH A GIVEN VERSION. CHANGE FROM –bin.zip TO –all.zip TO HAVE ACCESS TO GRADLE API SOURCES.
  • 12. GDUB https://github.com/dougborg/gdub A SCRIPT THAT CAN INVOKE A GRADLE BUILD ANYWHERE INSIDE THE PROJECT STRUCTURE. WILL ATTEMPT RESOLVING WRAPPER FIRST, THEN LOCAL GRADLE. FAILS IF NEITHER IS FOUND.
  • 14. TYPE LESS, DO MORE THE GRADLE COMMAND LINE CAN EXPAND COMMAND TARGETS IF YOU GIVE IT ENOUGH INFORMATION $ gradle publishToMavenLocal $ gradle puTML
  • 16. CHANGE BUILD FILE NAMES CHANGE BULD FILE NAME FROM BUILD.GRADLE TO ${project.name}.gradle USE GROOVY EXPRESSIONS TO FACTORIZE PROJECT INCLUSIONS IN settings.gradle
  • 17. SETTINGS.GRADLE (1/2) ['common',  'full',  'light'].each  {  name  -­‐>          File  subdir  =  new  File(rootDir,  name)          subdir.eachDir  {  dir  -­‐>                  File  buildFile  =  new  File(dir,  "${dir.name}.gradle")                  if  (buildFile.exists())  {                          include  "${name}/${dir.name}"                  }          }   }  
  • 18. SETTINGS.GRADLE (2/2) rootProject.name  =  'my-­‐project'   rootProject.children.each  {  project  -­‐>          int  slash  =  project.name.indexOf('/')          String  fileBaseName  =  project.name[(slash  +  1)..-­‐1]          String  projectDirName  =  project.name          project.name  =  fileBaseName          project.projectDir  =  new  File(settingsDir,  projectDirName)          project.buildFileName  =  "${fileBaseName}.gradle"          assert  project.projectDir.isDirectory()          assert  project.buildFile.isFile()   }  
  • 21. KEEP IT DRY EMBRACE THE POWER OF CONVENTIONS. BUILD FILE SHOULD DEFINE HOW THE PROJECT DEVIATES FROM THE PRE-ESTABLISHED CONVENTIONS. RELY ON SECONDARY SCRIPTS, SEGGREGATED BY RESPONSIBILITIES.
  • 22. TASK DEFINITIONS PUT THEM IN SEPARATE FILES. 1.  INSIDE SECONDARY SCRIPTS 1.  REGULAR TASK DEFINITIONS 2.  PLUGIN DEFINITIONS 2.  AS PART OF buildSrc SOURCES 3.  AS A PLUGIN PROJECT
  • 23. PLUGINS USE THE PLUGINS BLOCK DSL IF IN A SINGLE PROJECT. PLUGINS BLOCK DOES NOT WORK IN SECONDARY SCRIPTS. USE THE OLD-SCHOOL SYNTAX IF IN A MULTI-PROJECT AND NOT ALL SUBPROJECTS REQUIRE THE SAME PLUGINS.
  • 24. 8 DON’T REINVENT THE WHEEL, APPLY PLUGINS INSTEAD
  • 25. USEFUL PLUGINS Versions id 'com.github.ben-manes.versions' version '0.13.0’ License id 'com.github.hierynomus.license' version '0.11.0’ Versioning id 'net.nemerosa.versioning' version '2.4.0'
  • 26.
  • 28. MANIFEST ENTRIES ENRICH JAR MANIFESTS WITH ADDITIONAL ENTRIES SUCH AS 'Built-By': System.properties['user.name'], 'Created-By': "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})".toString(), 'Build-Date': buildDate, 'Build-Time': buildTime, 'Build-Revision': versioning.info.commit, 'Specification-Title': project.name, 'Specification-Version': project.version, 'Specification-Vendor': project.vendor, 'Implementation-Title': project.name, 'Implementation-Version': project.version, 'Implementation-Vendor': project.vendor
  • 30. INCREMENTAL BUILD ACTIVATED BY ADDING –t TO THE COMMAND LINE. EXECUTES A GIVEN COMMAND WHENEVER ITS RESOURCES (INPUTS) CHANGE. AVOID INVOKING THE CLEAN TASK AS MUCH AS YOU CAN.
  • 32. JACOCO OR BUST STEP 1: DEFINE A LIST OF PROJECTS TO INCLUDE ext  {          projectsWithCoverage  =  []          baseJaCocoDir  =  "${buildDir}/reports/jacoco/test/"          jacocoMergeExecFile  =  "${baseJaCocoDir  }jacocoTestReport.exec"          jacocoMergeReportHTMLFile  =  "${baseJaCocoDir  }/html/"          jacocoMergeReportXMLFile  =  "${baseJaCocoDir}/jacocoTestReport.xml"   }  
  • 33. JACOCO OR BUST STEP 2: ADD PROJECT TO COVERAGE LIST jacocoTestReport  {          group  =  'Reporting'          description  =  'Generate  Jacoco  coverage  reports  after  running  tests.'          additionalSourceDirs  =  project.files(sourceSets.main.allSource.srcDirs)          sourceDirectories  =  project.files(sourceSets.main.allSource.srcDirs)          classDirectories  =  project.files(sourceSets.main.output)          reports  {                  xml.enabled  =  true                  csv.enabled  =  false                  html.enabled  =  true          }   }   projectsWithCoverage  <<  project  
  • 34. JACOCO OR BUST STEP 3: DEFINE AGGREGATE TASKS IN ROOT PROJECT evaluationDependsOnChildren()  //  VERY  IMPORTANT!!     task  jacocoRootMerge(type:  org.gradle.testing.jacoco.tasks.JacocoMerge)  {          dependsOn  =  projectsWithCoverage.test  +   projectsWithCoverage.jacocoTestReport            executionData  =  projectsWithCoverage.jacocoTestReport.executionData          destinationFile  =  file(jacocoMergeExecFile)   }  
  • 35. JACOCO OR BUST STEP 3: DEFINE AGGREGATE TASKS IN ROOT PROJECT task  jacocoRootMergeReport(dependsOn:  jacocoRootMerge,  type:  JacocoReport)  {          executionData  projectsWithCoverage.jacocoTestReport.executionData          sourceDirectories  =  projectsWithCoverage.sourceSets.main.allSource.srcDirs          classDirectories  =  projectsWithCoverage.sourceSets.main.output            reports  {                  html.enabled  =  true                  xml.enabled  =  true                  html.destination  =  file(jacocoMergeReportHTMLFile)                  xml.destination  =  file(jacocoMergeReportXMLFile)          }   }  
  • 40. @DAILYGRADLE USEFUL TIPS POSTED EVERY WORKING DAY AT 5PM GMT.   FROM THE SAME PERSON THAT BROUGHT YOU “IDIOMATIC GRADLE” @YSB33R