SlideShare a Scribd company logo
1 of 96
Download to read offline
Gradle
The
Enterprise Automation
Tool
● SA at EPAM Systems
● primary skill is Java
● hands-on-coding with Groovy, Ruby
● exploring FP with Erlang/Elixir
● passionate about agile, clean code and devops
Agenda
● Introduction
● Gradle
● Step by step by features
● Alternatives
● References
● Q&A
Introduction
Build tools usage trend
Continuous Integration
Principles
#1 Each change auto. built and deployed
#2 Test on closed to prod environment
Principles
#1 Each change auto. built and deployed
#2 Test on closed to prod environment
#1 Each change auto. built and deployed
#3 Integrate as frequently as possible
Principles
#2 Test on closed to prod environment
#1 Each change auto. built and deployed
#3 Integrate as frequently as possible
Principles
#4 The highest priority is to fix failed build
Benefits
● Each change guarantees working code
● Each update should guarantee working
code ;)
● There is no delay for epic merge
● Less bugs - depends on your tests
efficiency*
● Allows to have code ready to go live
Challenges
● Need to build infrastructure
● Need to build team culture
● Need to support/enhance infrastructure
● Overhead with writing different kinds of
tests
Continuous D*
Principles
#1 Every commit should result in a release
Principles
#1 Every commit should result in a release
#2 Automated tests are essential
Principles
#1 Every commit should result in a release
#2 Automated tests are essential
#3 Automate everything!
Principles
#1 Every commit should result in a release
#2 Automated tests are essential
#3 Automate everything!
#4 Done means release/live in prod
Benefits
● Speed of delivery of business idea to
customer
● Easy going live deployment
● Less time spent on delivery - more profit
● More motivation to do more as you can
see what you can change/improve
Challenges
● Big effort to implement changes for:
○ database increment/rollback
○ infrastructure rollout/rollback
○ decrease down time …
● Need to get customers to buy in
● Security policies
Gradle
2.14.1
Gradle
- General purpose build system
Gradle
- General purpose build system
- Comes with a rich DSL based on Groovy
Gradle
- General purpose build system
- Comes with a rich DSL based on Groovy
- Follows ”build-by-convention” principles
Gradle
- General purpose build system
- Comes with a rich DSL based on Groovy
- Follows ”build-by-convention” principles
- Built-in plug-ins for JVM languages, etc
Gradle
- General purpose build system
- Comes with a rich DSL based on Groovy
- Follows ”build-by-convention” principles
- Built-in plug-ins for JVM languages, etc
- Derives all the best from Ivy, Ant & Maven
Features
1. JDK 8
2. Gradle 2.2+
3. Git
Prerequisites
1. Change directory to D:ImagesGradle folder
2. Open Command Window in dir D:ImagesGradle
3. Execute
​ Gitbingit clone
https://github.com/webdizz/sbs-gradle.git
4. Change directory to sbs-gradle
5. Execute
set_env.bat
gradle -v
java -version
#0 Installation
Groovy is under the hood
1. Reset code base to initial state
git reset --hard 3a2ed47
git clean -df​
2. Create file build.gradle
3. Type
​ println 'Hello, World!​​​​​​​​​​​'​
4. Run
gradle
#1 Hello World!
Declarative
1. Run to see default tasks list
gradle tasks
2. Replace build.gradle file content with
​ apply plugin: 'java'​
3. Run to see new available tasks
gradle tasks
4. Checkout step s3_apply_plugin
5. Run to build Java source code
gradle build
6. Explore directory build
#2 Create simple build
Flexible Execution
1. Run task with part of name
gradle ta
2. Run task with part of name to clean and compile
​ gradle cle tC
3. Run task with part of name to clean and compile and
exclude processTestResources
gradle cle tC -x pTR
4. Get details for task
gradle -q help --task clean
#3 Execute tasks
1. Run task
gradle tasks
2. Run task to generate wrapper
​ gradle wrapper
3. Run tasks using wrapper
./gradlew tasks
4. Customize task wrapper to use another Gradle version
​task wrapper(type: Wrapper) {
gradleVersion = '2.2.1'
}​
5. Check Gradle version
./gradlew -v
#4 Use wrapper
Multi-module Structure
1. Checkout step s5_prepare
2. Add directory common
3. Move src to common
4. Create common/build.gradle for Java
5. Add new module to settings.gradle
include ':common'​
6. Run build
./gradlew clean build
7. Run task for module
./gradlew :com:compJ
#5 Create multi-module build
Dependency Management
Gradle
- compile - to compile source
Gradle
- compile - to compile source
- runtime - required by classes at runtime
Gradle
- compile - to compile source
- runtime - required by classes at runtime
- testCompile - to compile test sources
Gradle
- compile - to compile source
- runtime - required by classes at runtime
- testCompile - to compile test sources
- testRuntime - required to run the tests
1. Add repositories to download dependencies from to
build.gradle
allprojects { currProject ->
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven {url 'http://repo.mycompany.com/’}
}
}​
#6 Dependencies
1. Add common dependencies for all subprojects in
build.gradle
subprojects {
apply plugin: 'java'
dependencies {
compile 'org.slf4j:slf4j-api:1.7.7'
testCompile
'org.mockito:mockito-core:1.10.19',
'junit:junit:4.12'
}
}​
#6.1 Dependencies
1. Add dependencies for concrete module in
common/build.gradle
dependencies {
compile
'org.projectlombok:lombok:1.14.4'
}​
#6.2 Dependencies
1. List project dependencies
./gradlew :common:dependencies
#6.3 Dependencies
Configuration
1. Extract common configuration parameters to gradle
.properties file
lombokVersion = 1.14.4
build.gradle file
dependencies {
compile
“org.projectlombok:lombok:$lombokVersion”
}​
#7 Configuration
1. Parameterise execution for custom task :printParameter
in build.gradle
task printParameter {
println givenParameter
}​
2. Add parameter default value to gradle.properties
3. Execute task
./gradlew -q :printParameter -PgivenParameter=hello
#7.1 Configuration
Rich API
#8 Rich API
● Lifecycle
● Create a Settings instance for the build.
● Evaluate the settings.gradle script, if present, against the Settings
object to configure it.
● Use the configured Settings object to create the hierarchy of Project
instances.
● Finally, evaluate each Project by executing its build.gradle file, if
present, against the project. The project are evaluated in such order
that a project is evaluated before its child projects.
● Tasks
● A project is essentially a collection of Task objects.
● Each task performs some basic piece of work.
● Dependencies
● A project generally has a number of dependencies.
● Project generally produces a number of artifacts, which other projects
can use.
● Plugins
● Plugins can be used to modularise and reuse project configuration.
● Properties
● Any property or method which your script uses is delegated through to
the associated Project object.
● A project has 5 property 'scopes'.
● Dynamic Methods
● A project has 5 method 'scopes'.
More Tests
1. Add integration test source sets in file
gradle/integTest.gradle
sourceSets {
integTest {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
}
}
#8.1 Rich API
2. Add integration test configurations in file
gradle/integTest.gradle
configurations {
integTestCompile.extendsFrom testCompile
integTestRuntime.extendsFrom testRuntime
}
3. Include extension for subprojects in file build.gradle
apply from:
file("${rootProject.projectDir}/gradle/integ
Test.gradle")​
#8.1 Rich API
3. Add integration test task in file gradle/integTest.gradle
task integTest(type: Test){
testClassesDir =
sourceSets.integTest.output.classesDir
classpath =
sourceSets.integTest.runtimeClasspath
shouldRunAfter 'test'
}
check.dependsOn(integTest)
4. Execute integration tests
./gradlew integTest
#8.1 Rich API
1. Open build.gradle to add dependency for one task
from another
​ printParameter.dependsOn 'help'​
2. Run printParameter task
./gradlew printParameter
#8.2 Tasks Dependencies
1. Open build.gradle to add ordering for one task from
another
task areTestsExist {
if ([
file("${projectDir}/src/test/java").listFiles()
].isEmpty()) {
println 'Test directory is empty'
} else {
println 'Test directory is not empty, will
execute tests'
}
}
test.mustRunAfter areTestsExist
#8.3 Tasks Ordering*
2. Run test task
./gradlew test
#8.3 Tasks Ordering*
1. Add rule to validate running of integration tests task
tasks.addRule('Check correctness of running tests'){ String
taskName ->
gradle.taskGraph.whenReady{
Map<String, String> args =
gradle.startParameter.systemPropertiesArgs
gradle.taskGraph.allTasks.each { Task task ->
if (task.name.contains('integTest') &&
!args.containsKey('profile')) {
throw new
org.gradle.api.tasks.StopExecutionException("Profile was not
specified to run tests (-Dprofile=ci).")
}
}
}
}
#8.4 Rules
2. Run check task to have failure
./gradlew check
3. Run check task with expected parameter
./gradlew check -Dprofile=ci
​
#8.4 Rules
Parallel Execution
1. Switch to 9th step and execute next command
./gradlew test --parallel
2. Try to modify amount of executable threads
./gradlew test --parallel --parallel-threads=3
​
#9 Parallel builds
Incremental Builds
1. Create file gradle/releaseNotes.gradle to add task for
release notes
ext.destDir = new File(buildDir, 'releaseNotes')
ext.releaseNotesTemplate = file('releaseNotes.tmpl.txt')
tasks.create(name: 'copyTask', type: org.gradle.api.tasks.Copy) {
from releaseNotesTemplate
into destDir
doFirst {
if (!destDir.exists()) {
destDir.mkdir()
}
}
rename { String fileName ->
fileName.replace('.tmpl', '')
}
}
#10 Custom Inputs/Outputs
tasks.create('releaseNotes') {
inputs.file copyTask
outputs.dir destDir
}
2. Add releaseNotes.tmpl.txt file as a template for release
notes
3. Apply configuration from gradle/releaseNotes.gradle in
build.gradle
4. Let’s run releaseNotes task
./gradlew releaseNotes
#10 Custom Inputs/Outputs
1. Enhance release notes task to prepare nice release notes file
​
ext.changesFile = file('changes.txt')
ext.bugs = []
ext.features = []
changesFile.eachLine { String line ->
String bugSymbol = '#bug:'
String featureSymbol = '#feature:'
if (line.contains(bugSymbol)) {
bugs << line.replace(bugSymbol, '')
} else if (line.contains(featureSymbol)) {
features << line.replace(featureSymbol, '')
}
}
filter(org.apache.tools.ant.filters.ReplaceTokens,
tokens: [bugs: bugs.join("n"),
features: features.join("n")])​
#10.1 Files filtering
Test Coverage
1. Add JaCoCo configuration in gradle/coverage.gradle
apply plugin: "jacoco"
jacoco {
toolVersion = "0.7.7.201606060606"
}
check.dependsOn jacocoTestReport
jacocoTestReport {
dependsOn 'test'
reports {
xml.enabled true
csv.enabled false
html.enabled true
}
}
#11 Test Coverage
2. Apply configuration from gradle/coverage.gradle in
build.gradle
3. Implement proper test for proper method
4. Let’s run check task to collect coverage metrics
./gradlew check -Dprofile=ci
5. Open
common/build/reports/jacoco/test/html/index.html file
to overview coverage
#11 Test Coverage
1. Add JaCoCo configuration in gradle/coverage.gradle for
integration tests
​task jacocoIntegrationTestReport(type: JacocoReport) {
dependsOn integTest
sourceSets sourceSets.main
executionData integTest
reports {
xml {
enabled true
destination
"$buildDir/reports/jacoco/integTest/jacocoIntegTestReport.xml"
}
csv.enabled false
html {
destination "$buildDir/reports/jacoco/integTest/html"
}
}
}
#11.1 Integration Test Coverage
check.dependsOn jacocoIntegrationTestReport
jacocoIntegrationTestReport.mustRunAfter jacocoTestReport
2. Let’s run check task to collect coverage metrics for
integration tests as well
./gradlew check -Dprofile=ci
​
#11.1 Integration Test Coverage
Static Code Analysis
Ad-hoc,
fast
feedback
Ad-hoc,
fast
feedback
Over
time
1. Add configuration in gradle/codeQuality.gradle for code
quality analysis and apply configuration in build.gradle
subprojects {
apply plugin: 'findbugs'
findbugs {
ignoreFailures = true
toolVersion = '3.0.0'
}
apply plugin: 'pmd'
pmd {
toolVersion = '5.1.3'
}
}
​
#12 Static Code Analysis
2. Let’s run check task to collect code quality metrics
./gradlew check -Dprofile=ci
3. Open common/build/reports/pmd|findbugs/*.html
​
​
#12 Static Code Analysis
Artefacts Publishing
1. Add configuration in gradle/publishing.gradle for artefacts
publishing and apply configuration in build.gradle
apply plugin: 'maven-publish'
publishing {
repositories {
maven {
url
"http://artifactory.vagrantshare.com/artifactory/libs-release-local"
credentials {
username 'admin'
password 'password'
}
}
}
publications {
mavenJava(MavenPublication) {
groupId "name.webdizz.${rootProject.name}"
version = uploadVersion
from components.java
}
}
}
#13 Artefacts Publishing
2. Let’s run publish task to publish artefacts
./gradlew publish -PuploadVersion=1.1.1.[YourName]
3. Check artefact was uploaded at
http://artifactory.vagrantshare.com/artifactory
​
​
#13 Artefacts Publishing
Plugable Architecture
● Build script
Visible for build file
● buildSrc/src/main/groovy
Visible for project
● Standalone project
Could be shared between projects using binary artefact
1. Create file PluginsPrinterPlugin.groovy in
buildSrc/src/main/groovy
​import org.gradle.api.Plugin
import org.gradle.api.Project
public class PluginsPrinterPlugin implements Plugin<Project> {
void apply(Project project) {
project.task('printPlugins') << {
println 'Current project has next list of plugins:'
ext.plugins = project.plugins.collect { plugin ->
plugin.class.simpleName
}
println plugins
}
}
}
#14 Plugins Printer
2. Apply plugin for all projects in build.gradle file
allprojects {
apply plugin: PluginsPrinterPlugin
}
3. Let’s run printPlugins task to print plugins activated for
project
./gradlew printPlugins
​
​
#14 Plugins Printer
Alternatives
- build
like you
code
- a software
project
management
and
comprehension
tool
References
● http://www.gradle.org/
● http://www.gradle.org/books
● https://plugins.gradle.org/
● http://groovy-lang.org/
● https://github.com/webdizz/sbs-gradle
● https://nebula-plugins.github.io/
References
Q&A
Izzet Mustafayev@EPAM Systems
@webdizz webdizz izzetmustafaiev
http://webdizz.name

More Related Content

What's hot

Quarkus - a next-generation Kubernetes Native Java framework
Quarkus - a next-generation Kubernetes Native Java frameworkQuarkus - a next-generation Kubernetes Native Java framework
Quarkus - a next-generation Kubernetes Native Java frameworkSVDevOps
 
Functional programming with Java 8
Functional programming with Java 8Functional programming with Java 8
Functional programming with Java 8LivePerson
 
PUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBootPUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBootJosué Neis
 
java 8 new features
java 8 new features java 8 new features
java 8 new features Rohit Verma
 
Discover Quarkus and GraalVM
Discover Quarkus and GraalVMDiscover Quarkus and GraalVM
Discover Quarkus and GraalVMRomain Schlick
 
Introduction to java (revised)
Introduction to java (revised)Introduction to java (revised)
Introduction to java (revised)Sujit Majety
 
Java 9 New Features
Java 9 New FeaturesJava 9 New Features
Java 9 New FeaturesAli BAKAN
 
Java 10 New Features
Java 10 New FeaturesJava 10 New Features
Java 10 New FeaturesAli BAKAN
 
Introduction to Java Programming Language
Introduction to Java Programming LanguageIntroduction to Java Programming Language
Introduction to Java Programming Languagejaimefrozr
 
Spring Framework - AOP
Spring Framework - AOPSpring Framework - AOP
Spring Framework - AOPDzmitry Naskou
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot IntroductionJeevesh Pandey
 
Maven Basics - Explained
Maven Basics - ExplainedMaven Basics - Explained
Maven Basics - ExplainedSmita Prasad
 

What's hot (20)

Quarkus - a next-generation Kubernetes Native Java framework
Quarkus - a next-generation Kubernetes Native Java frameworkQuarkus - a next-generation Kubernetes Native Java framework
Quarkus - a next-generation Kubernetes Native Java framework
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Functional programming with Java 8
Functional programming with Java 8Functional programming with Java 8
Functional programming with Java 8
 
PUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBootPUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBoot
 
java 8 new features
java 8 new features java 8 new features
java 8 new features
 
Discover Quarkus and GraalVM
Discover Quarkus and GraalVMDiscover Quarkus and GraalVM
Discover Quarkus and GraalVM
 
Java features
Java featuresJava features
Java features
 
Introduction to java (revised)
Introduction to java (revised)Introduction to java (revised)
Introduction to java (revised)
 
GitHub Basics - Derek Bable
GitHub Basics - Derek BableGitHub Basics - Derek Bable
GitHub Basics - Derek Bable
 
JVM++: The Graal VM
JVM++: The Graal VMJVM++: The Graal VM
JVM++: The Graal VM
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Java 9 New Features
Java 9 New FeaturesJava 9 New Features
Java 9 New Features
 
Quarkus k8s
Quarkus   k8sQuarkus   k8s
Quarkus k8s
 
Introduction of java
Introduction  of javaIntroduction  of java
Introduction of java
 
Java 10 New Features
Java 10 New FeaturesJava 10 New Features
Java 10 New Features
 
Introduction to Java Programming Language
Introduction to Java Programming LanguageIntroduction to Java Programming Language
Introduction to Java Programming Language
 
Spring Framework - AOP
Spring Framework - AOPSpring Framework - AOP
Spring Framework - AOP
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
 
Spring ppt
Spring pptSpring ppt
Spring ppt
 
Maven Basics - Explained
Maven Basics - ExplainedMaven Basics - Explained
Maven Basics - Explained
 

Viewers also liked

Gradle - time for a new build
Gradle - time for a new buildGradle - time for a new build
Gradle - time for a new buildIgor Khotin
 
Intro to CI/CD using Docker
Intro to CI/CD using DockerIntro to CI/CD using Docker
Intro to CI/CD using DockerMichael Irwin
 
Gradle: The Build System you have been waiting for!
Gradle: The Build System you have been waiting for!Gradle: The Build System you have been waiting for!
Gradle: The Build System you have been waiting for!Corneil du Plessis
 
Javaone - Gradle: Harder, Better, Stronger, Faster
Javaone - Gradle: Harder, Better, Stronger, Faster Javaone - Gradle: Harder, Better, Stronger, Faster
Javaone - Gradle: Harder, Better, Stronger, Faster Andres Almiray
 
Gradle enabled android project
Gradle enabled android projectGradle enabled android project
Gradle enabled android projectShaka Huang
 
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012Rajmahendra Hegde
 
Making a small QA system with Docker
Making a small QA system with DockerMaking a small QA system with Docker
Making a small QA system with DockerNaoki AINOYA
 
What's New in Docker 1.13?
What's New in Docker 1.13?What's New in Docker 1.13?
What's New in Docker 1.13?Michael Irwin
 
Android Gradle about using flavor
Android Gradle about using flavorAndroid Gradle about using flavor
Android Gradle about using flavorTed Liang
 
From Ant to Maven to Gradle a tale of CI tools for JVM
From Ant to Maven to Gradle a tale of CI tools for JVMFrom Ant to Maven to Gradle a tale of CI tools for JVM
From Ant to Maven to Gradle a tale of CI tools for JVMBucharest Java User Group
 
Captain Agile and the Providers of Value
Captain Agile and the Providers of ValueCaptain Agile and the Providers of Value
Captain Agile and the Providers of ValueSchalk Cronjé
 
Alpes Jug (29th March, 2010) - Apache Maven
Alpes Jug (29th March, 2010) - Apache MavenAlpes Jug (29th March, 2010) - Apache Maven
Alpes Jug (29th March, 2010) - Apache MavenArnaud Héritier
 

Viewers also liked (20)

Gradle by Example
Gradle by ExampleGradle by Example
Gradle by Example
 
Gradle - time for a new build
Gradle - time for a new buildGradle - time for a new build
Gradle - time for a new build
 
Gradle
GradleGradle
Gradle
 
Gradle in 45min
Gradle in 45minGradle in 45min
Gradle in 45min
 
Intro to CI/CD using Docker
Intro to CI/CD using DockerIntro to CI/CD using Docker
Intro to CI/CD using Docker
 
Gradle: The Build System you have been waiting for!
Gradle: The Build System you have been waiting for!Gradle: The Build System you have been waiting for!
Gradle: The Build System you have been waiting for!
 
Javaone - Gradle: Harder, Better, Stronger, Faster
Javaone - Gradle: Harder, Better, Stronger, Faster Javaone - Gradle: Harder, Better, Stronger, Faster
Javaone - Gradle: Harder, Better, Stronger, Faster
 
Gradle enabled android project
Gradle enabled android projectGradle enabled android project
Gradle enabled android project
 
Gradle presentation
Gradle presentationGradle presentation
Gradle presentation
 
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
 
Making a small QA system with Docker
Making a small QA system with DockerMaking a small QA system with Docker
Making a small QA system with Docker
 
What's New in Docker 1.13?
What's New in Docker 1.13?What's New in Docker 1.13?
What's New in Docker 1.13?
 
Building with Gradle
Building with GradleBuilding with Gradle
Building with Gradle
 
Git,Travis,Gradle
Git,Travis,GradleGit,Travis,Gradle
Git,Travis,Gradle
 
Gradle
GradleGradle
Gradle
 
Android Gradle about using flavor
Android Gradle about using flavorAndroid Gradle about using flavor
Android Gradle about using flavor
 
From Ant to Maven to Gradle a tale of CI tools for JVM
From Ant to Maven to Gradle a tale of CI tools for JVMFrom Ant to Maven to Gradle a tale of CI tools for JVM
From Ant to Maven to Gradle a tale of CI tools for JVM
 
Why gradle
Why gradle Why gradle
Why gradle
 
Captain Agile and the Providers of Value
Captain Agile and the Providers of ValueCaptain Agile and the Providers of Value
Captain Agile and the Providers of Value
 
Alpes Jug (29th March, 2010) - Apache Maven
Alpes Jug (29th March, 2010) - Apache MavenAlpes Jug (29th March, 2010) - Apache Maven
Alpes Jug (29th March, 2010) - Apache Maven
 

Similar to Gradle - the Enterprise Automation Tool

Make Your Build Great Again (DroidConSF 2017)
Make Your Build Great Again (DroidConSF 2017)Make Your Build Great Again (DroidConSF 2017)
Make Your Build Great Again (DroidConSF 2017)Jared Burrows
 
Gradle - Build system evolved
Gradle - Build system evolvedGradle - Build system evolved
Gradle - Build system evolvedBhagwat Kumar
 
Exploring the power of Gradle in android studio - Basics & Beyond
Exploring the power of Gradle in android studio - Basics & BeyondExploring the power of Gradle in android studio - Basics & Beyond
Exploring the power of Gradle in android studio - Basics & BeyondKaushal Dhruw
 
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017Ortus Solutions, Corp
 
What's new in Gradle 4.0
What's new in Gradle 4.0What's new in Gradle 4.0
What's new in Gradle 4.0Eric Wendelin
 
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
 
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
 
Eclipse Buildship JUG Hamburg
Eclipse Buildship JUG HamburgEclipse Buildship JUG Hamburg
Eclipse Buildship JUG Hamburgsimonscholz
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldRoberto Pérez Alcolea
 
Gradle 2.Write once, builde everywhere
Gradle 2.Write once, builde everywhereGradle 2.Write once, builde everywhere
Gradle 2.Write once, builde everywhereStrannik_2013
 
Gradle 2.breaking stereotypes.
Gradle 2.breaking stereotypes.Gradle 2.breaking stereotypes.
Gradle 2.breaking stereotypes.Stfalcon Meetups
 
Gradle,the new build system for android
Gradle,the new build system for androidGradle,the new build system for android
Gradle,the new build system for androidzhang ghui
 
10 Cool Facts about Gradle
10 Cool Facts about Gradle10 Cool Facts about Gradle
10 Cool Facts about GradleEvgeny Goldin
 

Similar to Gradle - the Enterprise Automation Tool (20)

Make Your Build Great Again (DroidConSF 2017)
Make Your Build Great Again (DroidConSF 2017)Make Your Build Great Again (DroidConSF 2017)
Make Your Build Great Again (DroidConSF 2017)
 
Gradle
GradleGradle
Gradle
 
Gradle - Build System
Gradle - Build SystemGradle - Build System
Gradle - Build System
 
Gradle - Build system evolved
Gradle - Build system evolvedGradle - Build system evolved
Gradle - Build system evolved
 
Gradle : An introduction
Gradle : An introduction Gradle : An introduction
Gradle : An introduction
 
ICONUK 2015 - Gradle Up!
ICONUK 2015 - Gradle Up!ICONUK 2015 - Gradle Up!
ICONUK 2015 - Gradle Up!
 
Exploring the power of Gradle in android studio - Basics & Beyond
Exploring the power of Gradle in android studio - Basics & BeyondExploring the power of Gradle in android studio - Basics & Beyond
Exploring the power of Gradle in android studio - Basics & Beyond
 
Why Gradle?
Why Gradle?Why Gradle?
Why Gradle?
 
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
 
What's new in Gradle 4.0
What's new in Gradle 4.0What's new in Gradle 4.0
What's new in Gradle 4.0
 
OpenCms Days 2012 - Developing OpenCms with Gradle
OpenCms Days 2012 - Developing OpenCms with GradleOpenCms Days 2012 - Developing OpenCms with Gradle
OpenCms Days 2012 - Developing OpenCms with Gradle
 
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]
 
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
 
Eclipse Buildship JUG Hamburg
Eclipse Buildship JUG HamburgEclipse Buildship JUG Hamburg
Eclipse Buildship JUG Hamburg
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
 
Gradle 2.Write once, builde everywhere
Gradle 2.Write once, builde everywhereGradle 2.Write once, builde everywhere
Gradle 2.Write once, builde everywhere
 
Gradle 2.breaking stereotypes.
Gradle 2.breaking stereotypes.Gradle 2.breaking stereotypes.
Gradle 2.breaking stereotypes.
 
Gradle,the new build system for android
Gradle,the new build system for androidGradle,the new build system for android
Gradle,the new build system for android
 
10 Cool Facts about Gradle
10 Cool Facts about Gradle10 Cool Facts about Gradle
10 Cool Facts about Gradle
 

More from Izzet Mustafaiev

Kotlin strives for Deep Learning
Kotlin strives for Deep LearningKotlin strives for Deep Learning
Kotlin strives for Deep LearningIzzet Mustafaiev
 
Consumer-Driven Contracts to enable API evolution
Consumer-Driven Contracts to enable API evolutionConsumer-Driven Contracts to enable API evolution
Consumer-Driven Contracts to enable API evolutionIzzet Mustafaiev
 
Functional web with elixir and elm in phoenix
Functional web with elixir and elm in phoenixFunctional web with elixir and elm in phoenix
Functional web with elixir and elm in phoenixIzzet Mustafaiev
 
Don’t let your code to be illiterate along with your colleagues
Don’t let your code to be illiterate along with your colleaguesDon’t let your code to be illiterate along with your colleagues
Don’t let your code to be illiterate along with your colleaguesIzzet Mustafaiev
 
Performance testing for web-scale
Performance testing for web-scalePerformance testing for web-scale
Performance testing for web-scaleIzzet Mustafaiev
 
[Szjug] Docker. Does it matter for java developer?
[Szjug] Docker. Does it matter for java developer?[Szjug] Docker. Does it matter for java developer?
[Szjug] Docker. Does it matter for java developer?Izzet Mustafaiev
 
Fault tolerance - look, it's simple!
Fault tolerance - look, it's simple!Fault tolerance - look, it's simple!
Fault tolerance - look, it's simple!Izzet Mustafaiev
 
µServices Architecture @ EPAM WOW 2015
µServices Architecture @ EPAM WOW 2015µServices Architecture @ EPAM WOW 2015
µServices Architecture @ EPAM WOW 2015Izzet Mustafaiev
 
Continuous Development Pipeline
Continuous Development PipelineContinuous Development Pipeline
Continuous Development PipelineIzzet Mustafaiev
 
Docker. Does it matter for Java developer ?
Docker. Does it matter for Java developer ?Docker. Does it matter for Java developer ?
Docker. Does it matter for Java developer ?Izzet Mustafaiev
 
Microservices Architecture
Microservices ArchitectureMicroservices Architecture
Microservices ArchitectureIzzet Mustafaiev
 
“Bootify your app - from zero to hero
“Bootify  your app - from zero to hero“Bootify  your app - from zero to hero
“Bootify your app - from zero to heroIzzet Mustafaiev
 
Metrics by coda hale : to know your app’ health
Metrics by coda hale : to know your app’ healthMetrics by coda hale : to know your app’ health
Metrics by coda hale : to know your app’ healthIzzet Mustafaiev
 
Buildr - build like you code
Buildr -  build like you codeBuildr -  build like you code
Buildr - build like you codeIzzet Mustafaiev
 

More from Izzet Mustafaiev (20)

Overcome a Frontier
Overcome a FrontierOvercome a Frontier
Overcome a Frontier
 
Web Security... Level Up
Web Security... Level UpWeb Security... Level Up
Web Security... Level Up
 
Kotlin strives for Deep Learning
Kotlin strives for Deep LearningKotlin strives for Deep Learning
Kotlin strives for Deep Learning
 
Can I do AI?
Can I do AI?Can I do AI?
Can I do AI?
 
Consumer-Driven Contracts to enable API evolution
Consumer-Driven Contracts to enable API evolutionConsumer-Driven Contracts to enable API evolution
Consumer-Driven Contracts to enable API evolution
 
Functional web with elixir and elm in phoenix
Functional web with elixir and elm in phoenixFunctional web with elixir and elm in phoenix
Functional web with elixir and elm in phoenix
 
Fabric8 CI/CD
Fabric8 CI/CDFabric8 CI/CD
Fabric8 CI/CD
 
Don’t let your code to be illiterate along with your colleagues
Don’t let your code to be illiterate along with your colleaguesDon’t let your code to be illiterate along with your colleagues
Don’t let your code to be illiterate along with your colleagues
 
Performance testing for web-scale
Performance testing for web-scalePerformance testing for web-scale
Performance testing for web-scale
 
[Szjug] Docker. Does it matter for java developer?
[Szjug] Docker. Does it matter for java developer?[Szjug] Docker. Does it matter for java developer?
[Szjug] Docker. Does it matter for java developer?
 
Fault tolerance - look, it's simple!
Fault tolerance - look, it's simple!Fault tolerance - look, it's simple!
Fault tolerance - look, it's simple!
 
µServices Architecture @ EPAM WOW 2015
µServices Architecture @ EPAM WOW 2015µServices Architecture @ EPAM WOW 2015
µServices Architecture @ EPAM WOW 2015
 
Continuous Development Pipeline
Continuous Development PipelineContinuous Development Pipeline
Continuous Development Pipeline
 
Docker. Does it matter for Java developer ?
Docker. Does it matter for Java developer ?Docker. Does it matter for Java developer ?
Docker. Does it matter for Java developer ?
 
Microservices Architecture
Microservices ArchitectureMicroservices Architecture
Microservices Architecture
 
“Bootify your app - from zero to hero
“Bootify  your app - from zero to hero“Bootify  your app - from zero to hero
“Bootify your app - from zero to hero
 
Metrics by coda hale : to know your app’ health
Metrics by coda hale : to know your app’ healthMetrics by coda hale : to know your app’ health
Metrics by coda hale : to know your app’ health
 
Buildr - build like you code
Buildr -  build like you codeBuildr -  build like you code
Buildr - build like you code
 
Groovy MOPping
Groovy MOPpingGroovy MOPping
Groovy MOPping
 
TDD with Spock @xpdays_ua
TDD with Spock @xpdays_uaTDD with Spock @xpdays_ua
TDD with Spock @xpdays_ua
 

Recently uploaded

Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noidabntitsolutionsrishis
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 

Recently uploaded (20)

Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 

Gradle - the Enterprise Automation Tool

  • 2. ● SA at EPAM Systems ● primary skill is Java ● hands-on-coding with Groovy, Ruby ● exploring FP with Erlang/Elixir ● passionate about agile, clean code and devops
  • 3. Agenda ● Introduction ● Gradle ● Step by step by features ● Alternatives ● References ● Q&A
  • 6.
  • 8. Principles #1 Each change auto. built and deployed
  • 9. #2 Test on closed to prod environment Principles #1 Each change auto. built and deployed
  • 10. #2 Test on closed to prod environment #1 Each change auto. built and deployed #3 Integrate as frequently as possible Principles
  • 11. #2 Test on closed to prod environment #1 Each change auto. built and deployed #3 Integrate as frequently as possible Principles #4 The highest priority is to fix failed build
  • 12. Benefits ● Each change guarantees working code ● Each update should guarantee working code ;) ● There is no delay for epic merge ● Less bugs - depends on your tests efficiency* ● Allows to have code ready to go live
  • 13. Challenges ● Need to build infrastructure ● Need to build team culture ● Need to support/enhance infrastructure ● Overhead with writing different kinds of tests
  • 15. Principles #1 Every commit should result in a release
  • 16. Principles #1 Every commit should result in a release #2 Automated tests are essential
  • 17. Principles #1 Every commit should result in a release #2 Automated tests are essential #3 Automate everything!
  • 18. Principles #1 Every commit should result in a release #2 Automated tests are essential #3 Automate everything! #4 Done means release/live in prod
  • 19. Benefits ● Speed of delivery of business idea to customer ● Easy going live deployment ● Less time spent on delivery - more profit ● More motivation to do more as you can see what you can change/improve
  • 20. Challenges ● Big effort to implement changes for: ○ database increment/rollback ○ infrastructure rollout/rollback ○ decrease down time … ● Need to get customers to buy in ● Security policies
  • 23. Gradle - General purpose build system
  • 24. Gradle - General purpose build system - Comes with a rich DSL based on Groovy
  • 25. Gradle - General purpose build system - Comes with a rich DSL based on Groovy - Follows ”build-by-convention” principles
  • 26. Gradle - General purpose build system - Comes with a rich DSL based on Groovy - Follows ”build-by-convention” principles - Built-in plug-ins for JVM languages, etc
  • 27. Gradle - General purpose build system - Comes with a rich DSL based on Groovy - Follows ”build-by-convention” principles - Built-in plug-ins for JVM languages, etc - Derives all the best from Ivy, Ant & Maven
  • 29. 1. JDK 8 2. Gradle 2.2+ 3. Git Prerequisites
  • 30. 1. Change directory to D:ImagesGradle folder 2. Open Command Window in dir D:ImagesGradle 3. Execute ​ Gitbingit clone https://github.com/webdizz/sbs-gradle.git 4. Change directory to sbs-gradle 5. Execute set_env.bat gradle -v java -version #0 Installation
  • 31. Groovy is under the hood
  • 32. 1. Reset code base to initial state git reset --hard 3a2ed47 git clean -df​ 2. Create file build.gradle 3. Type ​ println 'Hello, World!​​​​​​​​​​​'​ 4. Run gradle #1 Hello World!
  • 34. 1. Run to see default tasks list gradle tasks 2. Replace build.gradle file content with ​ apply plugin: 'java'​ 3. Run to see new available tasks gradle tasks 4. Checkout step s3_apply_plugin 5. Run to build Java source code gradle build 6. Explore directory build #2 Create simple build
  • 36. 1. Run task with part of name gradle ta 2. Run task with part of name to clean and compile ​ gradle cle tC 3. Run task with part of name to clean and compile and exclude processTestResources gradle cle tC -x pTR 4. Get details for task gradle -q help --task clean #3 Execute tasks
  • 37. 1. Run task gradle tasks 2. Run task to generate wrapper ​ gradle wrapper 3. Run tasks using wrapper ./gradlew tasks 4. Customize task wrapper to use another Gradle version ​task wrapper(type: Wrapper) { gradleVersion = '2.2.1' }​ 5. Check Gradle version ./gradlew -v #4 Use wrapper
  • 39. 1. Checkout step s5_prepare 2. Add directory common 3. Move src to common 4. Create common/build.gradle for Java 5. Add new module to settings.gradle include ':common'​ 6. Run build ./gradlew clean build 7. Run task for module ./gradlew :com:compJ #5 Create multi-module build
  • 41. Gradle - compile - to compile source
  • 42. Gradle - compile - to compile source - runtime - required by classes at runtime
  • 43. Gradle - compile - to compile source - runtime - required by classes at runtime - testCompile - to compile test sources
  • 44. Gradle - compile - to compile source - runtime - required by classes at runtime - testCompile - to compile test sources - testRuntime - required to run the tests
  • 45. 1. Add repositories to download dependencies from to build.gradle allprojects { currProject -> repositories { mavenLocal() mavenCentral() jcenter() maven {url 'http://repo.mycompany.com/’} } }​ #6 Dependencies
  • 46. 1. Add common dependencies for all subprojects in build.gradle subprojects { apply plugin: 'java' dependencies { compile 'org.slf4j:slf4j-api:1.7.7' testCompile 'org.mockito:mockito-core:1.10.19', 'junit:junit:4.12' } }​ #6.1 Dependencies
  • 47. 1. Add dependencies for concrete module in common/build.gradle dependencies { compile 'org.projectlombok:lombok:1.14.4' }​ #6.2 Dependencies
  • 48. 1. List project dependencies ./gradlew :common:dependencies #6.3 Dependencies
  • 50. 1. Extract common configuration parameters to gradle .properties file lombokVersion = 1.14.4 build.gradle file dependencies { compile “org.projectlombok:lombok:$lombokVersion” }​ #7 Configuration
  • 51. 1. Parameterise execution for custom task :printParameter in build.gradle task printParameter { println givenParameter }​ 2. Add parameter default value to gradle.properties 3. Execute task ./gradlew -q :printParameter -PgivenParameter=hello #7.1 Configuration
  • 54. ● Lifecycle ● Create a Settings instance for the build. ● Evaluate the settings.gradle script, if present, against the Settings object to configure it. ● Use the configured Settings object to create the hierarchy of Project instances. ● Finally, evaluate each Project by executing its build.gradle file, if present, against the project. The project are evaluated in such order that a project is evaluated before its child projects.
  • 55. ● Tasks ● A project is essentially a collection of Task objects. ● Each task performs some basic piece of work. ● Dependencies ● A project generally has a number of dependencies. ● Project generally produces a number of artifacts, which other projects can use.
  • 56. ● Plugins ● Plugins can be used to modularise and reuse project configuration. ● Properties ● Any property or method which your script uses is delegated through to the associated Project object. ● A project has 5 property 'scopes'. ● Dynamic Methods ● A project has 5 method 'scopes'.
  • 58. 1. Add integration test source sets in file gradle/integTest.gradle sourceSets { integTest { compileClasspath += main.output + test.output runtimeClasspath += main.output + test.output } } #8.1 Rich API
  • 59. 2. Add integration test configurations in file gradle/integTest.gradle configurations { integTestCompile.extendsFrom testCompile integTestRuntime.extendsFrom testRuntime } 3. Include extension for subprojects in file build.gradle apply from: file("${rootProject.projectDir}/gradle/integ Test.gradle")​ #8.1 Rich API
  • 60. 3. Add integration test task in file gradle/integTest.gradle task integTest(type: Test){ testClassesDir = sourceSets.integTest.output.classesDir classpath = sourceSets.integTest.runtimeClasspath shouldRunAfter 'test' } check.dependsOn(integTest) 4. Execute integration tests ./gradlew integTest #8.1 Rich API
  • 61. 1. Open build.gradle to add dependency for one task from another ​ printParameter.dependsOn 'help'​ 2. Run printParameter task ./gradlew printParameter #8.2 Tasks Dependencies
  • 62. 1. Open build.gradle to add ordering for one task from another task areTestsExist { if ([ file("${projectDir}/src/test/java").listFiles() ].isEmpty()) { println 'Test directory is empty' } else { println 'Test directory is not empty, will execute tests' } } test.mustRunAfter areTestsExist #8.3 Tasks Ordering*
  • 63. 2. Run test task ./gradlew test #8.3 Tasks Ordering*
  • 64. 1. Add rule to validate running of integration tests task tasks.addRule('Check correctness of running tests'){ String taskName -> gradle.taskGraph.whenReady{ Map<String, String> args = gradle.startParameter.systemPropertiesArgs gradle.taskGraph.allTasks.each { Task task -> if (task.name.contains('integTest') && !args.containsKey('profile')) { throw new org.gradle.api.tasks.StopExecutionException("Profile was not specified to run tests (-Dprofile=ci).") } } } } #8.4 Rules
  • 65. 2. Run check task to have failure ./gradlew check 3. Run check task with expected parameter ./gradlew check -Dprofile=ci ​ #8.4 Rules
  • 67. 1. Switch to 9th step and execute next command ./gradlew test --parallel 2. Try to modify amount of executable threads ./gradlew test --parallel --parallel-threads=3 ​ #9 Parallel builds
  • 69. 1. Create file gradle/releaseNotes.gradle to add task for release notes ext.destDir = new File(buildDir, 'releaseNotes') ext.releaseNotesTemplate = file('releaseNotes.tmpl.txt') tasks.create(name: 'copyTask', type: org.gradle.api.tasks.Copy) { from releaseNotesTemplate into destDir doFirst { if (!destDir.exists()) { destDir.mkdir() } } rename { String fileName -> fileName.replace('.tmpl', '') } } #10 Custom Inputs/Outputs
  • 70. tasks.create('releaseNotes') { inputs.file copyTask outputs.dir destDir } 2. Add releaseNotes.tmpl.txt file as a template for release notes 3. Apply configuration from gradle/releaseNotes.gradle in build.gradle 4. Let’s run releaseNotes task ./gradlew releaseNotes #10 Custom Inputs/Outputs
  • 71. 1. Enhance release notes task to prepare nice release notes file ​ ext.changesFile = file('changes.txt') ext.bugs = [] ext.features = [] changesFile.eachLine { String line -> String bugSymbol = '#bug:' String featureSymbol = '#feature:' if (line.contains(bugSymbol)) { bugs << line.replace(bugSymbol, '') } else if (line.contains(featureSymbol)) { features << line.replace(featureSymbol, '') } } filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [bugs: bugs.join("n"), features: features.join("n")])​ #10.1 Files filtering
  • 73. 1. Add JaCoCo configuration in gradle/coverage.gradle apply plugin: "jacoco" jacoco { toolVersion = "0.7.7.201606060606" } check.dependsOn jacocoTestReport jacocoTestReport { dependsOn 'test' reports { xml.enabled true csv.enabled false html.enabled true } } #11 Test Coverage
  • 74. 2. Apply configuration from gradle/coverage.gradle in build.gradle 3. Implement proper test for proper method 4. Let’s run check task to collect coverage metrics ./gradlew check -Dprofile=ci 5. Open common/build/reports/jacoco/test/html/index.html file to overview coverage #11 Test Coverage
  • 75. 1. Add JaCoCo configuration in gradle/coverage.gradle for integration tests ​task jacocoIntegrationTestReport(type: JacocoReport) { dependsOn integTest sourceSets sourceSets.main executionData integTest reports { xml { enabled true destination "$buildDir/reports/jacoco/integTest/jacocoIntegTestReport.xml" } csv.enabled false html { destination "$buildDir/reports/jacoco/integTest/html" } } } #11.1 Integration Test Coverage
  • 76. check.dependsOn jacocoIntegrationTestReport jacocoIntegrationTestReport.mustRunAfter jacocoTestReport 2. Let’s run check task to collect coverage metrics for integration tests as well ./gradlew check -Dprofile=ci ​ #11.1 Integration Test Coverage
  • 80. 1. Add configuration in gradle/codeQuality.gradle for code quality analysis and apply configuration in build.gradle subprojects { apply plugin: 'findbugs' findbugs { ignoreFailures = true toolVersion = '3.0.0' } apply plugin: 'pmd' pmd { toolVersion = '5.1.3' } } ​ #12 Static Code Analysis
  • 81. 2. Let’s run check task to collect code quality metrics ./gradlew check -Dprofile=ci 3. Open common/build/reports/pmd|findbugs/*.html ​ ​ #12 Static Code Analysis
  • 83. 1. Add configuration in gradle/publishing.gradle for artefacts publishing and apply configuration in build.gradle apply plugin: 'maven-publish' publishing { repositories { maven { url "http://artifactory.vagrantshare.com/artifactory/libs-release-local" credentials { username 'admin' password 'password' } } } publications { mavenJava(MavenPublication) { groupId "name.webdizz.${rootProject.name}" version = uploadVersion from components.java } } } #13 Artefacts Publishing
  • 84. 2. Let’s run publish task to publish artefacts ./gradlew publish -PuploadVersion=1.1.1.[YourName] 3. Check artefact was uploaded at http://artifactory.vagrantshare.com/artifactory ​ ​ #13 Artefacts Publishing
  • 86. ● Build script Visible for build file ● buildSrc/src/main/groovy Visible for project ● Standalone project Could be shared between projects using binary artefact
  • 87. 1. Create file PluginsPrinterPlugin.groovy in buildSrc/src/main/groovy ​import org.gradle.api.Plugin import org.gradle.api.Project public class PluginsPrinterPlugin implements Plugin<Project> { void apply(Project project) { project.task('printPlugins') << { println 'Current project has next list of plugins:' ext.plugins = project.plugins.collect { plugin -> plugin.class.simpleName } println plugins } } } #14 Plugins Printer
  • 88. 2. Apply plugin for all projects in build.gradle file allprojects { apply plugin: PluginsPrinterPlugin } 3. Let’s run printPlugins task to print plugins activated for project ./gradlew printPlugins ​ ​ #14 Plugins Printer
  • 93. ● http://www.gradle.org/ ● http://www.gradle.org/books ● https://plugins.gradle.org/ ● http://groovy-lang.org/ ● https://github.com/webdizz/sbs-gradle ● https://nebula-plugins.github.io/ References
  • 94. Q&A
  • 95.
  • 96. Izzet Mustafayev@EPAM Systems @webdizz webdizz izzetmustafaiev http://webdizz.name