SlideShare a Scribd company logo
Gradle. 
Enemy at the gates. 
Сергей Моренец, morenets@mail.ru 
23 мая 2014 г.
About author 
• Works in IT since 2000 
• 10 year of Java SE/EE experience 
• Migrated to Gradle after 7 years of Ant/Maven 
usage 
• Regular speaker at Java conferences
Agenda 
• Builds tools overview 
• Gradle under the microscope 
• Examples 
• Q & A
Lost in selection
Magic pill
Gradle 
• Flexible yet model-driven JVM-based build tool 
• Acknowledges and improves on the very best ideas 
from Make, Ant, Ivy, Maven, Rake, Gant, Scons, SBT, 
Leinengen, and Buildr
Gradle 
• Flexibility of Ant 
• Dependency management from Ivy 
• Intelligence of Maven 
• Speed and hashing of Git 
• Metaprogramming power of Groovy
Apache Ant 
• Offers extreme flexibility 
• Imposes no convention 
• Lightweight dependency management
Apache Ivy 
• Cross-platform dependency management 
• Transitive dependencies 
• Enhanced support of repositories
Apache Maven 
• Offers rigid standards and support for dependency 
management 
• More difficult and inflexible standards/procedures 
• Declarative approach
Issue #1. XML 
• Large and complex files are hard to understand 
• Hierarchical structure limits the expressiveness 
of the format 
• Good format for the data and complex for the flow
Issues #2. Frameworkitis 
• Frameworkitis is the disease that a framework wants 
to do too much for you or it does it in a way that 
you don't want but you can't change it 
• The bigger the framework becomes, the greater the 
chances that it will want to do too much, the bigger 
the learning curves become, and the more difficult 
it becomes to maintain it 
• Group of small frameworks(toolkits) is better than 
big framework
Solution #1. Groovy 
• An agile and dynamic language for the Java 
Virtual Machine 
• Makes modern programming features available to 
Java developers with almost-zero learning curve 
• Provides the ability to statically type 
check and statically compile your code for 
robustness and performance 
• Supports Domain-Specific Languages and other 
compact syntax 
• Every Gradle build file is Groovy script
Gradle 
• First release in Apr 2008 
• Current version 1.12 released in April 2014 
• Used in Carrier, EADS, Hibernate, Grails, Groovy, 
Spring-Security and Spring-Integration
Hans Dockter 
• Founder of Gradle and Gradleware 
• 13 years of experience as a software developer, 
team leader, architect, trainer, and mentor 
• Previously worked at Jboss and founded Jboss-IDE 
• Holds a Diploma in Physics with a minor in Computer 
Science 
• Admirer of domain-driven-design
Slogan 
• Make the impossible possible 
• Make the possible easy 
• Make the easy elegant
Gradle overview 
• A flexible general purpose build tool 
• Declarative builds and build-by-convention plugins 
on top 
• Multi-project support 
• Powerful dependency management based on Ivy 
• Programming tool 
• Based on Groovy 
• Gradle is written in Java with a Groovy DSL layer on 
top
Build structure 
• Gradle build consists of one or more projects 
• Project contains one or more tasks 
• Task is fundamental unit of build activity 
• Tasks are named collections of build instructions 
• Tasks are the equivalent to Ant targets 
• Task is made up of actions
Hello world 
• $ gradle helloWorld
build.gradle
Maven pom
Build phases 
Initialization 
Configuration 
Execution
Initialization 
• Gradle defines which projects are involved in build 
• Project instance is defined for each involved 
project
Configuration 
• Task objects are assembled into an internal object 
model, usually called the DAG 
• The build scripts of all projects which are part of the 
build are executed 
• If “configuration on demand” feature is enabled 
then only relevant projects are configured
Execution 
• Gradle determines the subset of the tasks, created 
and configured during the configuration phase 
• Subset of tasks depends on the gradle command 
argument and the contents of the current directory. 
• Selected tasks are executed in the order required 
by their dependency relationships
DefaultTask 
• dependsOn(task) 
• doFirst(closure) 
• doLast(closure) 
• onlyIf(closure)
Sample project
Sample project
Dependent tasks
Task types 
Copy Jar 
JavaCompile JavaExec 
JettyRun War
Custom task 
• Writes audit information at the end of the build 
• Audit information includes project name and build 
timestamp 
• Audit files are located in the separate folder
Custom task
Custom task
Custom task
Custom task
Multi-project builds 
• Build where you build more than one project during 
a single execution of Gradle 
• Sub-projects should be defined in settings.gradle 
• Settings file is analyzed in the initialization phase 
when sub-projects are revealed and included into 
DAG 
• Sub-projects are sub-directories in the simplest case
settings.gradle
Plugin 
• Reusable pieces of build logic 
• Can be used in different projects/builds 
• Can be written in Groovy, Java or Scala
Plugin 
• Add tasks to the project 
• Pre-configure added tasks with useful defaults 
• Add dependency configurations to the project 
• Add new properties and methods to existing type 
via extensions
Plugins 
• Android 
• AspectJ 
• Flex 
• Grails 
• GWT 
• JavaScript 
• JAXB 
• Jenkins 
• SvnKit 
• Tomcat 
• Xslt
Plugin import
Packaging 
• Build script 
• buildSrc project 
• rootProjectDir/buildSrc/src/main/groovy 
• Standalone project
Custom plugin
Custom plugin
Custom plugin
Custom plugin 
• $ gradle writeBuild
Custom plugin
Integration 
• Ant 
• Maven
Gradle and Ant 
• Gradle is often described as Groovy-based Ant. 
• Competitor of Gant(Groovy Ant scripting) 
• Share DAG concept 
• Gradle tasks are similar to Ant targrets 
• Gradle variables(typeless) are close to Ant 
properties
Hello Ant
Ant import
Gradle and Maven
Gradle and Maven 
Maven Coordinate Gradle Property Gradle Default 
groupId group blank 
artifactId name Project directory 
name 
version version unspecified 
name N/A N/A 
description description null
Comparison 
Operation Gradle Maven 
Build(sec) 21,2 24,2 
Inc build(sec) 8,7 11 
Build with 
29 28 
tests(sec) 
Clean(sec) 3,9 3,1 
Distributive(Mb) 44 3
Maven converter 
• Create build.gradle file in the root folder 
• Specify apply plugin: 'maven2Gradle' in the 
build.gradle file. 
• Run gradle maven2Gradle
Maven Dependencies 
Scopes: 
• compile 
• provided 
• runtime 
• test 
• system 
• import
Dependencies
Gradle Dependencies 
configurations: 
• compile 
• default 
• testCompile 
• testRuntime 
• archives 
• runtime
Scope flexibility
Repositories 
• Gradle provides a bridge implementation to Ivy- or 
Maven-formatted repositories
Profiles 
• build.gradle 
• dev-profile.gradle 
• test-profile.gradle 
• $ gradle –Pprofile=dev build
Resource handling
Resource handling
Unit testing 
• Junit 
• TestNG 
• Spock 
• Geb 
• EasyB
Skip tasks 
• $ gradle -PskipTests
Skip tasks
Skip tasks
Caching 
• Gradle caches all compiles scripts by default 
• Compiled scripts are put into .gradle folder 
• Gradle uses compiled version if the script hasn’t 
changed 
• --recompile-scripts option discards cache
Practical tasks 
• Multiple projects 
• Liquibase 
• Deployment
Multiple projects 
• Huge project 
• Multiple sub-projects/pom.xml files 
• Complicated maintenance
Liquibase 
• Plugins for 2 and 3 versions 
• Lightweight front-end for Liquibase command-line 
• Gradle task for each Liquibase command
Deployment 
• Separate plugins for Jetty/Tomcat 
• General plugin for multiple containers
Pros 
• Native Java interaction 
• Ant/Maven integration 
• Transitive dependency management(based on 
Maven/Ivy) 
• Multiple third-party plugins(70+) 
• Incremental builds 
• Rapid development
Cons 
• Less efficient due to script nature 
• Large learning curve 
• Less community & industry support
Future 
• Testing toolkit for integration into business logic 
• Improved plugin portal and plugin development 
• Execution of Maven builds/plugins at runtime 
• Distributed testing 
• Parallel and distributed execution 
… to be continued 
Resources
Practice 
• https://github.com/hibernate/hibernate-orm 
• https://github.com/SpringSource/spring-framework 
• https://github.com/gradle/gradle
Q&A 
• Сергей Моренец, morenets@mail.ru

More Related Content

What's hot

Enterprise build tool gradle
Enterprise build tool gradleEnterprise build tool gradle
Enterprise build tool gradle
Deepak Shevani
 
Gradle - Build system evolved
Gradle - Build system evolvedGradle - Build system evolved
Gradle - Build system evolved
Bhagwat Kumar
 
Javantura v4 - The power of cloud in professional services company - Ivan Krn...
Javantura v4 - The power of cloud in professional services company - Ivan Krn...Javantura v4 - The power of cloud in professional services company - Ivan Krn...
Javantura v4 - The power of cloud in professional services company - Ivan Krn...
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
Continuous Deployment into the Unknown with Artifactory, Bintray, Docker and ...
Continuous Deployment into the Unknown with Artifactory, Bintray, Docker and ...Continuous Deployment into the Unknown with Artifactory, Bintray, Docker and ...
Continuous Deployment into the Unknown with Artifactory, Bintray, Docker and ...
Gilad Garon
 
Cucumber jvm best practices v3
Cucumber jvm best practices v3Cucumber jvm best practices v3
Cucumber jvm best practices v3
Ahmed Misbah
 
Javantura v4 - CroDuke Indy and the Kingdom of Java Skills - Branko Mihaljevi...
Javantura v4 - CroDuke Indy and the Kingdom of Java Skills - Branko Mihaljevi...Javantura v4 - CroDuke Indy and the Kingdom of Java Skills - Branko Mihaljevi...
Javantura v4 - CroDuke Indy and the Kingdom of Java Skills - Branko Mihaljevi...
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
Go - A Key Language in Enterprise Application Development?
Go - A Key Language in Enterprise Application Development?Go - A Key Language in Enterprise Application Development?
Go - A Key Language in Enterprise Application Development?
C4Media
 
Devoxx Belgium 2017 - easy microservices with JHipster
Devoxx Belgium 2017 - easy microservices with JHipsterDevoxx Belgium 2017 - easy microservices with JHipster
Devoxx Belgium 2017 - easy microservices with JHipster
Julien Dubois
 
Introduction to Anchore Engine
Introduction to Anchore EngineIntroduction to Anchore Engine
Introduction to Anchore Engine
Maarten Smeets
 
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
Kaushal Dhruw
 
JavaEdge 2008: Your next version control system
JavaEdge 2008: Your next version control systemJavaEdge 2008: Your next version control system
JavaEdge 2008: Your next version control system
Gilad Garon
 
Artifacts management with DevOps
Artifacts management with DevOpsArtifacts management with DevOps
Artifacts management with DevOps
Chen-Tien Tsai
 
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
zhang ghui
 
Implementing FaaS on Kubernetes using Kubeless
Implementing FaaS on Kubernetes using KubelessImplementing FaaS on Kubernetes using Kubeless
Implementing FaaS on Kubernetes using Kubeless
Ahmed Misbah
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
Betclic Everest Group Tech Team
 
Javantura v4 - Android App Development in 2017 - Matej Vidaković
Javantura v4 - Android App Development in 2017 - Matej VidakovićJavantura v4 - Android App Development in 2017 - Matej Vidaković
Javantura v4 - Android App Development in 2017 - Matej Vidaković
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
Play 2 Java Framework with TDD
Play 2 Java Framework with TDDPlay 2 Java Framework with TDD
Play 2 Java Framework with TDD
Basav Nagur
 
From java to scala at crowd mix
From java to scala at crowd mixFrom java to scala at crowd mix
From java to scala at crowd mix
Stefano Galarraga
 
Javantura v4 - What’s NOT new in modular Java - Milen Dyankov
Javantura v4 - What’s NOT new in modular Java - Milen DyankovJavantura v4 - What’s NOT new in modular Java - Milen Dyankov
Javantura v4 - What’s NOT new in modular Java - Milen Dyankov
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
SSJS, NoSQL, GAE and AppengineJS
SSJS, NoSQL, GAE and AppengineJSSSJS, NoSQL, GAE and AppengineJS
SSJS, NoSQL, GAE and AppengineJS
Eugene Lazutkin
 

What's hot (20)

Enterprise build tool gradle
Enterprise build tool gradleEnterprise build tool gradle
Enterprise build tool gradle
 
Gradle - Build system evolved
Gradle - Build system evolvedGradle - Build system evolved
Gradle - Build system evolved
 
Javantura v4 - The power of cloud in professional services company - Ivan Krn...
Javantura v4 - The power of cloud in professional services company - Ivan Krn...Javantura v4 - The power of cloud in professional services company - Ivan Krn...
Javantura v4 - The power of cloud in professional services company - Ivan Krn...
 
Continuous Deployment into the Unknown with Artifactory, Bintray, Docker and ...
Continuous Deployment into the Unknown with Artifactory, Bintray, Docker and ...Continuous Deployment into the Unknown with Artifactory, Bintray, Docker and ...
Continuous Deployment into the Unknown with Artifactory, Bintray, Docker and ...
 
Cucumber jvm best practices v3
Cucumber jvm best practices v3Cucumber jvm best practices v3
Cucumber jvm best practices v3
 
Javantura v4 - CroDuke Indy and the Kingdom of Java Skills - Branko Mihaljevi...
Javantura v4 - CroDuke Indy and the Kingdom of Java Skills - Branko Mihaljevi...Javantura v4 - CroDuke Indy and the Kingdom of Java Skills - Branko Mihaljevi...
Javantura v4 - CroDuke Indy and the Kingdom of Java Skills - Branko Mihaljevi...
 
Go - A Key Language in Enterprise Application Development?
Go - A Key Language in Enterprise Application Development?Go - A Key Language in Enterprise Application Development?
Go - A Key Language in Enterprise Application Development?
 
Devoxx Belgium 2017 - easy microservices with JHipster
Devoxx Belgium 2017 - easy microservices with JHipsterDevoxx Belgium 2017 - easy microservices with JHipster
Devoxx Belgium 2017 - easy microservices with JHipster
 
Introduction to Anchore Engine
Introduction to Anchore EngineIntroduction to Anchore Engine
Introduction to Anchore Engine
 
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
 
JavaEdge 2008: Your next version control system
JavaEdge 2008: Your next version control systemJavaEdge 2008: Your next version control system
JavaEdge 2008: Your next version control system
 
Artifacts management with DevOps
Artifacts management with DevOpsArtifacts management with DevOps
Artifacts management with DevOps
 
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
 
Implementing FaaS on Kubernetes using Kubeless
Implementing FaaS on Kubernetes using KubelessImplementing FaaS on Kubernetes using Kubeless
Implementing FaaS on Kubernetes using Kubeless
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
Javantura v4 - Android App Development in 2017 - Matej Vidaković
Javantura v4 - Android App Development in 2017 - Matej VidakovićJavantura v4 - Android App Development in 2017 - Matej Vidaković
Javantura v4 - Android App Development in 2017 - Matej Vidaković
 
Play 2 Java Framework with TDD
Play 2 Java Framework with TDDPlay 2 Java Framework with TDD
Play 2 Java Framework with TDD
 
From java to scala at crowd mix
From java to scala at crowd mixFrom java to scala at crowd mix
From java to scala at crowd mix
 
Javantura v4 - What’s NOT new in modular Java - Milen Dyankov
Javantura v4 - What’s NOT new in modular Java - Milen DyankovJavantura v4 - What’s NOT new in modular Java - Milen Dyankov
Javantura v4 - What’s NOT new in modular Java - Milen Dyankov
 
SSJS, NoSQL, GAE and AppengineJS
SSJS, NoSQL, GAE and AppengineJSSSJS, NoSQL, GAE and AppengineJS
SSJS, NoSQL, GAE and AppengineJS
 

Viewers also liked

Effective Java applications
Effective Java applicationsEffective Java applications
Effective Java applications
Strannik_2013
 
JSF 2: Myth of panacea? Magic world of user interfaces
JSF 2: Myth of panacea? Magic world of user interfacesJSF 2: Myth of panacea? Magic world of user interfaces
JSF 2: Myth of panacea? Magic world of user interfaces
Strannik_2013
 
Getting ready to java 8
Getting ready to java 8Getting ready to java 8
Getting ready to java 8
Strannik_2013
 
Effectiveness and code optimization in Java
Effectiveness and code optimization in JavaEffectiveness and code optimization in Java
Effectiveness and code optimization in Java
Strannik_2013
 
Java 8 in action.Jinq
Java 8 in action.JinqJava 8 in action.Jinq
Java 8 in action.Jinq
Strannik_2013
 
Gradle 2.Write once, builde everywhere
Gradle 2.Write once, builde everywhereGradle 2.Write once, builde everywhere
Gradle 2.Write once, builde everywhere
Strannik_2013
 
Top 10 reasons to migrate to Gradle
Top 10 reasons to migrate to GradleTop 10 reasons to migrate to Gradle
Top 10 reasons to migrate to Gradle
Strannik_2013
 
Spring Web flow. A little flow of happiness
Spring Web flow. A little flow of happinessSpring Web flow. A little flow of happiness
Spring Web flow. A little flow of happiness
Strannik_2013
 
Spring Boot. Boot up your development
Spring Boot. Boot up your developmentSpring Boot. Boot up your development
Spring Boot. Boot up your development
Strannik_2013
 
Spring Web Flow. A little flow of happiness.
Spring Web Flow. A little flow of happiness.Spring Web Flow. A little flow of happiness.
Spring Web Flow. A little flow of happiness.
Alex Tumanoff
 
Serialization and performance in Java
Serialization and performance in JavaSerialization and performance in Java
Serialization and performance in Java
Strannik_2013
 
Spring Boot. Boot up your development. JEEConf 2015
Spring Boot. Boot up your development. JEEConf 2015Spring Boot. Boot up your development. JEEConf 2015
Spring Boot. Boot up your development. JEEConf 2015
Strannik_2013
 
Spring.Boot up your development
Spring.Boot up your developmentSpring.Boot up your development
Spring.Boot up your development
Strannik_2013
 
Junior,middle,senior?
Junior,middle,senior?Junior,middle,senior?
Junior,middle,senior?
Strannik_2013
 
JEEConf 2016. Effectiveness and code optimization in Java applications
JEEConf 2016. Effectiveness and code optimization in  Java applicationsJEEConf 2016. Effectiveness and code optimization in  Java applications
JEEConf 2016. Effectiveness and code optimization in Java applications
Strannik_2013
 

Viewers also liked (15)

Effective Java applications
Effective Java applicationsEffective Java applications
Effective Java applications
 
JSF 2: Myth of panacea? Magic world of user interfaces
JSF 2: Myth of panacea? Magic world of user interfacesJSF 2: Myth of panacea? Magic world of user interfaces
JSF 2: Myth of panacea? Magic world of user interfaces
 
Getting ready to java 8
Getting ready to java 8Getting ready to java 8
Getting ready to java 8
 
Effectiveness and code optimization in Java
Effectiveness and code optimization in JavaEffectiveness and code optimization in Java
Effectiveness and code optimization in Java
 
Java 8 in action.Jinq
Java 8 in action.JinqJava 8 in action.Jinq
Java 8 in action.Jinq
 
Gradle 2.Write once, builde everywhere
Gradle 2.Write once, builde everywhereGradle 2.Write once, builde everywhere
Gradle 2.Write once, builde everywhere
 
Top 10 reasons to migrate to Gradle
Top 10 reasons to migrate to GradleTop 10 reasons to migrate to Gradle
Top 10 reasons to migrate to Gradle
 
Spring Web flow. A little flow of happiness
Spring Web flow. A little flow of happinessSpring Web flow. A little flow of happiness
Spring Web flow. A little flow of happiness
 
Spring Boot. Boot up your development
Spring Boot. Boot up your developmentSpring Boot. Boot up your development
Spring Boot. Boot up your development
 
Spring Web Flow. A little flow of happiness.
Spring Web Flow. A little flow of happiness.Spring Web Flow. A little flow of happiness.
Spring Web Flow. A little flow of happiness.
 
Serialization and performance in Java
Serialization and performance in JavaSerialization and performance in Java
Serialization and performance in Java
 
Spring Boot. Boot up your development. JEEConf 2015
Spring Boot. Boot up your development. JEEConf 2015Spring Boot. Boot up your development. JEEConf 2015
Spring Boot. Boot up your development. JEEConf 2015
 
Spring.Boot up your development
Spring.Boot up your developmentSpring.Boot up your development
Spring.Boot up your development
 
Junior,middle,senior?
Junior,middle,senior?Junior,middle,senior?
Junior,middle,senior?
 
JEEConf 2016. Effectiveness and code optimization in Java applications
JEEConf 2016. Effectiveness and code optimization in  Java applicationsJEEConf 2016. Effectiveness and code optimization in  Java applications
JEEConf 2016. Effectiveness and code optimization in Java applications
 

Similar to Gradle.Enemy at the gates

Hands on Gradle
Hands on GradleHands on Gradle
Hands on Gradle
Mushfekur Rahman
 
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
 
Gradle - Build System
Gradle - Build SystemGradle - Build System
Gradle - Build System
Jeevesh Pandey
 
Introduction to Grails 2013
Introduction to Grails 2013Introduction to Grails 2013
Introduction to Grails 2013Gavin Hogan
 
Building with Gradle
Building with GradleBuilding with Gradle
Building with Gradle
Laurynas Tretjakovas
 
Tips For Maintaining OSS Projects
Tips For Maintaining OSS ProjectsTips For Maintaining OSS Projects
Tips For Maintaining OSS Projects
Taro L. Saito
 
Using Grunt with Drupal
Using Grunt with DrupalUsing Grunt with Drupal
Using Grunt with Drupal
arithmetric
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with Gradle
Ryan Cuprak
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with Gradle
Ryan Cuprak
 
S/W Design and Modularity using Maven
S/W Design and Modularity using MavenS/W Design and Modularity using Maven
S/W Design and Modularity using Maven
Scheidt & Bachmann
 
Gradle
GradleGradle
GraalVM and Oracle's Documentation Trends.pdf
GraalVM and Oracle's Documentation Trends.pdfGraalVM and Oracle's Documentation Trends.pdf
GraalVM and Oracle's Documentation Trends.pdf
ohupalo
 
From GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX Apps
From GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX AppsFrom GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX Apps
From GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX Apps
Bruno Borges
 
Gradle
GradleGradle
Gradle
Han Yin
 
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
E. Camden Fisher
 
Build your android app with gradle
Build your android app with gradleBuild your android app with gradle
Build your android app with gradle
Swain Loda
 
Gradle - the Enterprise Automation Tool
Gradle  - the Enterprise Automation ToolGradle  - the Enterprise Automation Tool
Gradle - the Enterprise Automation Tool
Izzet Mustafaiev
 
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
Bucharest Java User Group
 
Java Edge.2009.Grails.Web.Dev.Made.Easy
Java Edge.2009.Grails.Web.Dev.Made.EasyJava Edge.2009.Grails.Web.Dev.Made.Easy
Java Edge.2009.Grails.Web.Dev.Made.Easyroialdaag
 
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
Eric Wendelin
 

Similar to Gradle.Enemy at the gates (20)

Hands on Gradle
Hands on GradleHands on Gradle
Hands on 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]
 
Gradle - Build System
Gradle - Build SystemGradle - Build System
Gradle - Build System
 
Introduction to Grails 2013
Introduction to Grails 2013Introduction to Grails 2013
Introduction to Grails 2013
 
Building with Gradle
Building with GradleBuilding with Gradle
Building with Gradle
 
Tips For Maintaining OSS Projects
Tips For Maintaining OSS ProjectsTips For Maintaining OSS Projects
Tips For Maintaining OSS Projects
 
Using Grunt with Drupal
Using Grunt with DrupalUsing Grunt with Drupal
Using Grunt with Drupal
 
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
 
S/W Design and Modularity using Maven
S/W Design and Modularity using MavenS/W Design and Modularity using Maven
S/W Design and Modularity using Maven
 
Gradle
GradleGradle
Gradle
 
GraalVM and Oracle's Documentation Trends.pdf
GraalVM and Oracle's Documentation Trends.pdfGraalVM and Oracle's Documentation Trends.pdf
GraalVM and Oracle's Documentation Trends.pdf
 
From GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX Apps
From GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX AppsFrom GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX Apps
From GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX Apps
 
Gradle
GradleGradle
Gradle
 
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
 
Build your android app with gradle
Build your android app with gradleBuild your android app with gradle
Build your android app with gradle
 
Gradle - the Enterprise Automation Tool
Gradle  - the Enterprise Automation ToolGradle  - the Enterprise Automation Tool
Gradle - the Enterprise Automation Tool
 
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
 
Java Edge.2009.Grails.Web.Dev.Made.Easy
Java Edge.2009.Grails.Web.Dev.Made.EasyJava Edge.2009.Grails.Web.Dev.Made.Easy
Java Edge.2009.Grails.Web.Dev.Made.Easy
 
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
 

Recently uploaded

A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 

Recently uploaded (20)

A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 

Gradle.Enemy at the gates

  • 1. Gradle. Enemy at the gates. Сергей Моренец, morenets@mail.ru 23 мая 2014 г.
  • 2. About author • Works in IT since 2000 • 10 year of Java SE/EE experience • Migrated to Gradle after 7 years of Ant/Maven usage • Regular speaker at Java conferences
  • 3. Agenda • Builds tools overview • Gradle under the microscope • Examples • Q & A
  • 6. Gradle • Flexible yet model-driven JVM-based build tool • Acknowledges and improves on the very best ideas from Make, Ant, Ivy, Maven, Rake, Gant, Scons, SBT, Leinengen, and Buildr
  • 7. Gradle • Flexibility of Ant • Dependency management from Ivy • Intelligence of Maven • Speed and hashing of Git • Metaprogramming power of Groovy
  • 8. Apache Ant • Offers extreme flexibility • Imposes no convention • Lightweight dependency management
  • 9. Apache Ivy • Cross-platform dependency management • Transitive dependencies • Enhanced support of repositories
  • 10. Apache Maven • Offers rigid standards and support for dependency management • More difficult and inflexible standards/procedures • Declarative approach
  • 11. Issue #1. XML • Large and complex files are hard to understand • Hierarchical structure limits the expressiveness of the format • Good format for the data and complex for the flow
  • 12. Issues #2. Frameworkitis • Frameworkitis is the disease that a framework wants to do too much for you or it does it in a way that you don't want but you can't change it • The bigger the framework becomes, the greater the chances that it will want to do too much, the bigger the learning curves become, and the more difficult it becomes to maintain it • Group of small frameworks(toolkits) is better than big framework
  • 13. Solution #1. Groovy • An agile and dynamic language for the Java Virtual Machine • Makes modern programming features available to Java developers with almost-zero learning curve • Provides the ability to statically type check and statically compile your code for robustness and performance • Supports Domain-Specific Languages and other compact syntax • Every Gradle build file is Groovy script
  • 14. Gradle • First release in Apr 2008 • Current version 1.12 released in April 2014 • Used in Carrier, EADS, Hibernate, Grails, Groovy, Spring-Security and Spring-Integration
  • 15. Hans Dockter • Founder of Gradle and Gradleware • 13 years of experience as a software developer, team leader, architect, trainer, and mentor • Previously worked at Jboss and founded Jboss-IDE • Holds a Diploma in Physics with a minor in Computer Science • Admirer of domain-driven-design
  • 16. Slogan • Make the impossible possible • Make the possible easy • Make the easy elegant
  • 17. Gradle overview • A flexible general purpose build tool • Declarative builds and build-by-convention plugins on top • Multi-project support • Powerful dependency management based on Ivy • Programming tool • Based on Groovy • Gradle is written in Java with a Groovy DSL layer on top
  • 18. Build structure • Gradle build consists of one or more projects • Project contains one or more tasks • Task is fundamental unit of build activity • Tasks are named collections of build instructions • Tasks are the equivalent to Ant targets • Task is made up of actions
  • 19. Hello world • $ gradle helloWorld
  • 22. Build phases Initialization Configuration Execution
  • 23. Initialization • Gradle defines which projects are involved in build • Project instance is defined for each involved project
  • 24. Configuration • Task objects are assembled into an internal object model, usually called the DAG • The build scripts of all projects which are part of the build are executed • If “configuration on demand” feature is enabled then only relevant projects are configured
  • 25. Execution • Gradle determines the subset of the tasks, created and configured during the configuration phase • Subset of tasks depends on the gradle command argument and the contents of the current directory. • Selected tasks are executed in the order required by their dependency relationships
  • 26. DefaultTask • dependsOn(task) • doFirst(closure) • doLast(closure) • onlyIf(closure)
  • 30. Task types Copy Jar JavaCompile JavaExec JettyRun War
  • 31. Custom task • Writes audit information at the end of the build • Audit information includes project name and build timestamp • Audit files are located in the separate folder
  • 36. Multi-project builds • Build where you build more than one project during a single execution of Gradle • Sub-projects should be defined in settings.gradle • Settings file is analyzed in the initialization phase when sub-projects are revealed and included into DAG • Sub-projects are sub-directories in the simplest case
  • 38. Plugin • Reusable pieces of build logic • Can be used in different projects/builds • Can be written in Groovy, Java or Scala
  • 39. Plugin • Add tasks to the project • Pre-configure added tasks with useful defaults • Add dependency configurations to the project • Add new properties and methods to existing type via extensions
  • 40. Plugins • Android • AspectJ • Flex • Grails • GWT • JavaScript • JAXB • Jenkins • SvnKit • Tomcat • Xslt
  • 42. Packaging • Build script • buildSrc project • rootProjectDir/buildSrc/src/main/groovy • Standalone project
  • 46. Custom plugin • $ gradle writeBuild
  • 48. Integration • Ant • Maven
  • 49. Gradle and Ant • Gradle is often described as Groovy-based Ant. • Competitor of Gant(Groovy Ant scripting) • Share DAG concept • Gradle tasks are similar to Ant targrets • Gradle variables(typeless) are close to Ant properties
  • 53. Gradle and Maven Maven Coordinate Gradle Property Gradle Default groupId group blank artifactId name Project directory name version version unspecified name N/A N/A description description null
  • 54. Comparison Operation Gradle Maven Build(sec) 21,2 24,2 Inc build(sec) 8,7 11 Build with 29 28 tests(sec) Clean(sec) 3,9 3,1 Distributive(Mb) 44 3
  • 55. Maven converter • Create build.gradle file in the root folder • Specify apply plugin: 'maven2Gradle' in the build.gradle file. • Run gradle maven2Gradle
  • 56. Maven Dependencies Scopes: • compile • provided • runtime • test • system • import
  • 58. Gradle Dependencies configurations: • compile • default • testCompile • testRuntime • archives • runtime
  • 60. Repositories • Gradle provides a bridge implementation to Ivy- or Maven-formatted repositories
  • 61. Profiles • build.gradle • dev-profile.gradle • test-profile.gradle • $ gradle –Pprofile=dev build
  • 64. Unit testing • Junit • TestNG • Spock • Geb • EasyB
  • 65. Skip tasks • $ gradle -PskipTests
  • 68. Caching • Gradle caches all compiles scripts by default • Compiled scripts are put into .gradle folder • Gradle uses compiled version if the script hasn’t changed • --recompile-scripts option discards cache
  • 69. Practical tasks • Multiple projects • Liquibase • Deployment
  • 70. Multiple projects • Huge project • Multiple sub-projects/pom.xml files • Complicated maintenance
  • 71. Liquibase • Plugins for 2 and 3 versions • Lightweight front-end for Liquibase command-line • Gradle task for each Liquibase command
  • 72. Deployment • Separate plugins for Jetty/Tomcat • General plugin for multiple containers
  • 73. Pros • Native Java interaction • Ant/Maven integration • Transitive dependency management(based on Maven/Ivy) • Multiple third-party plugins(70+) • Incremental builds • Rapid development
  • 74. Cons • Less efficient due to script nature • Large learning curve • Less community & industry support
  • 75. Future • Testing toolkit for integration into business logic • Improved plugin portal and plugin development • Execution of Maven builds/plugins at runtime • Distributed testing • Parallel and distributed execution … to be continued 
  • 77. Practice • https://github.com/hibernate/hibernate-orm • https://github.com/SpringSource/spring-framework • https://github.com/gradle/gradle
  • 78. Q&A • Сергей Моренец, morenets@mail.ru