SlideShare a Scribd company logo
1 of 69
Download to read offline
Gradle
time for a new build!
time for a new build




                    Igor Khotin
                 E-mail: khotin@gmx.com
Background
● 12+ years in the IT industry
● 7+ years with Java

● Flexible design promoter

● Agile-junkie
What do we use?
●   Ant?
●   Maven?
●   Buildr?
●   Gradle?
●   ...
Any problems?
●   heavy builds?
●   long integration cycles?
●   build projects support?
●   build projects
    integration?
●   ...
How we used to build?
punchcards...
give them to an operator
waiting for result...
take the printouts...
debug?
1977 – make
2000
ant   Complexity
ant             Complexity
      hard to reuse
ant             Complexity
      hard to reuse

                heavy build.xml's
ant             Complexity
      hard to reuse

                heavy build.xml's

            Total Control
2001
maven



   convention over configuration
maven

                   maven central

   convention over configuration
maven

                        maven central

      convention over configuration

dependency management
maven                      heavy xml's

                        maven central

      convention over configuration

dependency management
maven                       heavy xml's

 hard to implement
 custom behavior        maven central

        convention over configuration

dependency management
maven                       heavy xml's

 hard to implement
 custom behavior         maven central

        convention over configuration

dependency management


          lost control
Gradle yesterday
●   Founder - Hans Dockter
●   2008 – early releases
●   2010 Springy Innovation Award
Gradle today
●   1.0-rc2 released on April 25, 2012
●   Active community
●   Gradleware
●   Apache License, Version 2.0
Gradle in the wild
Who is that Gradle?
●   Build integration tool
●   Declarative builds
●   Groovy-based build DSL
●   Build-by-convention
Who is that Gradle?
●   Scalable – multi-project builds
●   Dependency management
●   Ease of migration
●   Embeddable
●   Deep API
Gradle positioning
Groovy and Gradle
build.gradle

task count << {
    4.times { print "$it " }
}


> gradle -q count
0 1 2 3
gradle task != ant task


gradle task == ant target
Build tree
Dependencies
task build << {
    println 'building...'
}
task count(dependsOn: build) << {
    4.times { print "$it " }
}


> gradle -q count
building...
0 1 2 3
Lazy dependencies
task build(dependsOn: 'lazy') << {
    println 'building...'
}
task lazy << {
    println 'so lazy...'
}


> gradle -q hello
so lazy...
building...
Rules
build.gradle
tasks.addRule("Pattern: ping<ID>") { String taskName ->
    if (taskName.startsWith("ping")) {
        task(taskName) << {
            println "Pinging: " + (taskName - 'ping')
        }
    }
}
task groupPing {
    dependsOn pingServer1, pingServer2
}

> gradle -q groupPing
Pinging: Server1
Pinging: Server2
Gradle Plugins

tasks – objects – conventions
Gradle Plugins
       java   scala groovy cpp antrl
       checkstyle findbugs pmd sonar
           ear   war osgi jetty maven
Java Plugin
build.gradle

apply plugin: 'java'




> gradle build
...
Java Plugin Folder Layout

src/main/java        Production Java source
src/main/resources   Production resources
src/test/java        Test Java source
src/test/resources   Test resources




                      just like maven...
Java Plugin Tasks Flow
Java Plugin Tasks Flow




     { println 'injecting...' }



   Injectable with Groovy closures
Java build-cycle customization
apply plugin: 'java'

test.doFirst {
    println 'Before testing...'
}
test.doLast {
    println '...after testing.'
}
Dependency management
●   You can define rules for dependencies
●   Flexible repository handling
●   Works with Ivy and Maven repositories
●   Dynamic properties
●   and more...
Java & jars
apply plugin: 'java'
repositories {
    mavenCentral()
}
dependencies {
   compile 'commons-lang:commons-lang:2.5'
   testCompile 'junit:junit:4.8.1'
}
Ant
ant.importBuild 'build.xml'

task ant << {
    ant.echo(message: 'hello from Ant')
    ant.zip(destfile: 'archive.zip') {
        fileset(dir: 'src') {
            include(name: '**.xml')
            exclude(name: '**.java')
        }
    }
}
Build Lifecycle

  Initialization

  Configuration


  Execution
Multi-project builds
●   Arbitrary multi-project layout
●   Configuration injection
●   Separate config/execution tree
●   Partial builds
Multi-project builds
include 'project1', 'project2'

root-project/
  build.gradle
  settings.gradle
  project1/
    build.gradle
  project2/
    build.gradle
Gradle daemon
●   To reduce the startup time
●   Used in STS Gradle plugin for Eclipse
●   Used in Intellij IDEA plugin (IDEA>10)
●   Used by default in Tooling API
Apache Ant vs. Apache Maven vs. Gradle
ant
<?xml version="1.0"?>
<project name="simple" default="dist" basedir=".">
  <property name="src" location="src/main/java"/>
  <property name="srcTest" location="src/test/java"/>
  <property name="build" location="build"/>
  <property name="dist" location="${build}/lib"/>
  <property name="version" value="1.0-SNAPSHOT" />
  <path id="classpath.compile">
    <pathelement location="libs/commons-lang-2.5.jar"/>
  </path>
  <path id="classpath.test">
    <pathelement location="libs/junit-4.8.2.jar"/>
    <pathelement location="libs/commons-lang-2.5.jar"/>
    <pathelement location="${srcTest}"/>
    <pathelement location="${build}/classes"/>
    <pathelement location="${build}/test-classes"/>
  </path>
...
ant
...
  <target name="init">
    <mkdir dir="${build}/classes"/>
    <mkdir dir="${build}/test-classes"/>
  </target>
  <target name="compile" depends="init">
    <javac srcdir="${src}" destdir="${build}/classes">
     <classpath refid="classpath.compile"/>
    </javac>
  </target>
  <target name="testCompile" depends="compile">
    <javac srcdir="${srcTest}" destdir="${build}/test-classes">
     <classpath refid="classpath.test"/>
    </javac>
  </target>
...
ant
...
<target name="test" depends="testCompile">
    <junit fork="yes" haltonfailure="yes">
     <batchtest fork="yes">
       <fileset dir="${srcTest}">
        <include name="**/*Test.java"/>
       </fileset>
     </batchtest>
     <classpath refid="classpath.test"/>
     <formatter type="plain"/>
    </junit>
  </target>
  <target name="dist" depends="test">
    <mkdir dir="${dist}"/>
    <jar jarfile="${dist}/coc-comparison-${version}.jar"
                                       basedir="${build}/classes"/>
  </target>
  <target name="clean"><delete dir="${build}"/></target>
</project>
maven
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
    http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>grId</groupId>
  <artifactId>coc-comparison</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
...
maven
...
  <dependencies>
    <dependency>
     <groupId>commons-lang</groupId>
     <artifactId>commons-lang</artifactId>
     <version>2.5</version>
    </dependency>
    <dependency>
     <groupId>junit</groupId>
     <artifactId>junit</artifactId>
     <version>4.8.1</version>
     <scope>test</scope>
    </dependency>
  </dependencies>
</project>
polyglot maven
project {
  modelVersion '4.0.0'
  artifactId 'coc-comparison'
  groupId 'grId'
  version '1.0-SNAPSHOT'

    dependencies {
      dependency('commons-lang:commons-lang:2.5')
      dependency('junit:junit:4.8.1')
    }

    properties {
      'maven.compiler.target' '1.6'
      'maven.compiler.source' '1.6'
    }
}
gradle
apply plugin: 'java'

version="1.0-SNAPSHOT"
group="grId"
archivesBaseName="coc-comparison"

repositories {
    mavenCentral()
}

dependencies {
  compile 'commons-lang:commons-lang:2.5'
  testCompile 'junit:junit:4.8.1'
}
Gradle problems
Gradle bugs
IDE integration
market penetration
Gradle tomorrow
●   Release 1.0 till the end of 2012
    ● Deep import of maven projects
    ● Release management


    ● Smart testing


    ● Archetypes?
Resources
●   gradle.org
●   groovy.codehaus.org
●   sonatype.org
●   ant.apache.org/ivy
Questions
Contacts
Igor Khotin
E-mail: khotin@gmx.com
Blog: www.ikhotin.com
Twitter: chaostarter

More Related Content

What's hot

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
 
Gradle 3.0: Unleash the Daemon!
Gradle 3.0: Unleash the Daemon!Gradle 3.0: Unleash the Daemon!
Gradle 3.0: Unleash the Daemon!Eric Wendelin
 
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
 
Managing dependencies with gradle
Managing dependencies with gradleManaging dependencies with gradle
Managing dependencies with gradleLiviu Tudor
 
うさぎ組 in G* WorkShop -うさみみの日常-
うさぎ組 in G* WorkShop -うさみみの日常-うさぎ組 in G* WorkShop -うさみみの日常-
うさぎ組 in G* WorkShop -うさみみの日常-kyon mm
 
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
 
Basic Gradle Plugin Writing
Basic Gradle Plugin WritingBasic Gradle Plugin Writing
Basic Gradle Plugin WritingSchalk Cronjé
 
Gradle plugins, take it to the next level
Gradle plugins, take it to the next levelGradle plugins, take it to the next level
Gradle plugins, take it to the next levelEyal Lezmy
 
Gradle - Build system evolved
Gradle - Build system evolvedGradle - Build system evolved
Gradle - Build system evolvedBhagwat Kumar
 
An introduction to maven gradle and sbt
An introduction to maven gradle and sbtAn introduction to maven gradle and sbt
An introduction to maven gradle and sbtFabio Fumarola
 
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
 

What's hot (20)

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
 
Gradle : An introduction
Gradle : An introduction Gradle : An introduction
Gradle : An introduction
 
Gradle 3.0: Unleash the Daemon!
Gradle 3.0: Unleash the Daemon!Gradle 3.0: Unleash the Daemon!
Gradle 3.0: Unleash the Daemon!
 
Android presentation - Gradle ++
Android presentation - Gradle ++Android presentation - Gradle ++
Android presentation - Gradle ++
 
Building with Gradle
Building with GradleBuilding with Gradle
Building with Gradle
 
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!
 
Gradle in 45min
Gradle in 45minGradle in 45min
Gradle in 45min
 
Gradle
GradleGradle
Gradle
 
Introduction to gradle
Introduction to gradleIntroduction to gradle
Introduction to gradle
 
Managing dependencies with gradle
Managing dependencies with gradleManaging dependencies with gradle
Managing dependencies with gradle
 
Gradle by Example
Gradle by ExampleGradle by Example
Gradle by Example
 
うさぎ組 in G* WorkShop -うさみみの日常-
うさぎ組 in G* WorkShop -うさみみの日常-うさぎ組 in G* WorkShop -うさみみの日常-
うさぎ組 in G* WorkShop -うさみみの日常-
 
Hands on the Gradle
Hands on the GradleHands on the Gradle
Hands on the Gradle
 
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
 
Basic Gradle Plugin Writing
Basic Gradle Plugin WritingBasic Gradle Plugin Writing
Basic Gradle Plugin Writing
 
Gradle plugins, take it to the next level
Gradle plugins, take it to the next levelGradle plugins, take it to the next level
Gradle plugins, take it to the next level
 
Gradle - Build system evolved
Gradle - Build system evolvedGradle - Build system evolved
Gradle - Build system evolved
 
An introduction to maven gradle and sbt
An introduction to maven gradle and sbtAn introduction to maven gradle and sbt
An introduction to maven gradle and sbt
 
Gradle como alternativa a maven
Gradle como alternativa a mavenGradle como alternativa a maven
Gradle como alternativa a maven
 
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
 

Viewers also liked

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 2.breaking stereotypes.
Gradle 2.breaking stereotypes.Gradle 2.breaking stereotypes.
Gradle 2.breaking stereotypes.Stfalcon Meetups
 
Moving towards Reactive Programming
Moving towards Reactive ProgrammingMoving towards Reactive Programming
Moving towards Reactive ProgrammingDeepak Shevani
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx 2015
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx 2015Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx 2015
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx 2015Matt Raible
 
Enterprise build tool gradle
Enterprise build tool gradleEnterprise build tool gradle
Enterprise build tool gradleDeepak Shevani
 
Intro to CI/CD using Docker
Intro to CI/CD using DockerIntro to CI/CD using Docker
Intro to CI/CD using DockerMichael Irwin
 
Getting Started with Spring Boot
Getting Started with Spring BootGetting Started with Spring Boot
Getting Started with Spring BootDavid Kiss
 
Gradle and build systems for C language
Gradle and build systems for C languageGradle and build systems for C language
Gradle and build systems for C languageJuraj Michálek
 
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
 
Pluggable Infrastructure with CI/CD and Docker
Pluggable Infrastructure with CI/CD and DockerPluggable Infrastructure with CI/CD and Docker
Pluggable Infrastructure with CI/CD and DockerBob Killen
 
Terraforming organisations
Terraforming organisationsTerraforming organisations
Terraforming organisationsClaudio Perrone
 
不只自動化而且更敏捷的Android開發工具 gradle mopcon
不只自動化而且更敏捷的Android開發工具 gradle mopcon不只自動化而且更敏捷的Android開發工具 gradle mopcon
不只自動化而且更敏捷的Android開發工具 gradle mopconsam chiu
 

Viewers also liked (17)

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 2.breaking stereotypes.
Gradle 2.breaking stereotypes.Gradle 2.breaking stereotypes.
Gradle 2.breaking stereotypes.
 
Moving towards Reactive Programming
Moving towards Reactive ProgrammingMoving towards Reactive Programming
Moving towards Reactive Programming
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx 2015
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx 2015Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx 2015
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx 2015
 
Git,Travis,Gradle
Git,Travis,GradleGit,Travis,Gradle
Git,Travis,Gradle
 
Enterprise build tool gradle
Enterprise build tool gradleEnterprise build tool gradle
Enterprise build tool gradle
 
Intro to CI/CD using Docker
Intro to CI/CD using DockerIntro to CI/CD using Docker
Intro to CI/CD using Docker
 
Getting Started with Spring Boot
Getting Started with Spring BootGetting Started with Spring Boot
Getting Started with Spring Boot
 
Gradle and build systems for C language
Gradle and build systems for C languageGradle and build systems for C language
Gradle and build systems for C language
 
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
 
Pluggable Infrastructure with CI/CD and Docker
Pluggable Infrastructure with CI/CD and DockerPluggable Infrastructure with CI/CD and Docker
Pluggable Infrastructure with CI/CD and Docker
 
Terraforming organisations
Terraforming organisationsTerraforming organisations
Terraforming organisations
 
Gradle
GradleGradle
Gradle
 
不只自動化而且更敏捷的Android開發工具 gradle mopcon
不只自動化而且更敏捷的Android開發工具 gradle mopcon不只自動化而且更敏捷的Android開發工具 gradle mopcon
不只自動化而且更敏捷的Android開發工具 gradle mopcon
 

Similar to Gradle - time for a new build

Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010Tomek Kaczanowski
 
In the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: GradleIn the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: GradleSkills Matter
 
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
 
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: The Build system you have been waiting for
Gradle: The Build system you have been waiting forGradle: The Build system you have been waiting for
Gradle: The Build system you have been waiting forCorneil du Plessis
 
Introduction to Maven
Introduction to MavenIntroduction to Maven
Introduction to MavenSperasoft
 
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
 
Making the Most of Your Gradle Builds
Making the Most of Your Gradle BuildsMaking the Most of Your Gradle Builds
Making the Most of Your Gradle BuildsEgor Andreevich
 
Gradleintroduction 111010130329-phpapp01
Gradleintroduction 111010130329-phpapp01Gradleintroduction 111010130329-phpapp01
Gradleintroduction 111010130329-phpapp01Tino Isnich
 
Javascript ui for rest services
Javascript ui for rest servicesJavascript ui for rest services
Javascript ui for rest servicesIoan Eugen Stan
 
10 Cool Facts about Gradle
10 Cool Facts about Gradle10 Cool Facts about Gradle
10 Cool Facts about GradleEvgeny Goldin
 
Antons Kranga Building Agile Infrastructures
Antons Kranga   Building Agile InfrastructuresAntons Kranga   Building Agile Infrastructures
Antons Kranga Building Agile InfrastructuresAntons Kranga
 
Gradle notes
Gradle notesGradle notes
Gradle notesDum My
 
I Love APIs 2015: Continuous Integration the Virtuous Cycle
I Love APIs 2015: Continuous Integration the Virtuous CycleI Love APIs 2015: Continuous Integration the Virtuous Cycle
I Love APIs 2015: Continuous Integration the Virtuous CycleApigee | Google Cloud
 

Similar to Gradle - time for a new build (20)

Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010
 
In the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: GradleIn the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: Gradle
 
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
 
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]
 
Gradle: The Build system you have been waiting for
Gradle: The Build system you have been waiting forGradle: The Build system you have been waiting for
Gradle: The Build system you have been waiting for
 
Introduction to Maven
Introduction to MavenIntroduction to Maven
Introduction to Maven
 
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)
 
GradleFX
GradleFXGradleFX
GradleFX
 
Making the Most of Your Gradle Builds
Making the Most of Your Gradle BuildsMaking the Most of Your Gradle Builds
Making the Most of Your Gradle Builds
 
Enter the gradle
Enter the gradleEnter the gradle
Enter the gradle
 
Gradleintroduction 111010130329-phpapp01
Gradleintroduction 111010130329-phpapp01Gradleintroduction 111010130329-phpapp01
Gradleintroduction 111010130329-phpapp01
 
Gradle
GradleGradle
Gradle
 
Javascript ui for rest services
Javascript ui for rest servicesJavascript ui for rest services
Javascript ui for rest services
 
10 Cool Facts about Gradle
10 Cool Facts about Gradle10 Cool Facts about Gradle
10 Cool Facts about Gradle
 
Groovy Maven Builds
Groovy Maven BuildsGroovy Maven Builds
Groovy Maven Builds
 
Antons Kranga Building Agile Infrastructures
Antons Kranga   Building Agile InfrastructuresAntons Kranga   Building Agile Infrastructures
Antons Kranga Building Agile Infrastructures
 
Gradle notes
Gradle notesGradle notes
Gradle notes
 
I Love APIs 2015: Continuous Integration the Virtuous Cycle
I Love APIs 2015: Continuous Integration the Virtuous CycleI Love APIs 2015: Continuous Integration the Virtuous Cycle
I Love APIs 2015: Continuous Integration the Virtuous Cycle
 

More from Igor Khotin

The craft of meta programming on JVM
The craft of meta programming on JVMThe craft of meta programming on JVM
The craft of meta programming on JVMIgor Khotin
 
Spring cloud for microservices architecture
Spring cloud for microservices architectureSpring cloud for microservices architecture
Spring cloud for microservices architectureIgor Khotin
 
WDB005.1 - JavaScript for Java Developers (Lecture 1)
WDB005.1 - JavaScript for Java Developers (Lecture 1)WDB005.1 - JavaScript for Java Developers (Lecture 1)
WDB005.1 - JavaScript for Java Developers (Lecture 1)Igor Khotin
 
Business value in game development
Business value in game developmentBusiness value in game development
Business value in game developmentIgor Khotin
 
Cassandra Prophecy
Cassandra ProphecyCassandra Prophecy
Cassandra ProphecyIgor Khotin
 
Gradle - next generation of build tools
Gradle - next generation of build toolsGradle - next generation of build tools
Gradle - next generation of build toolsIgor Khotin
 
Igor Khotin - Domain Specific Languages
Igor Khotin - Domain Specific LanguagesIgor Khotin - Domain Specific Languages
Igor Khotin - Domain Specific LanguagesIgor Khotin
 

More from Igor Khotin (8)

The craft of meta programming on JVM
The craft of meta programming on JVMThe craft of meta programming on JVM
The craft of meta programming on JVM
 
Spring cloud for microservices architecture
Spring cloud for microservices architectureSpring cloud for microservices architecture
Spring cloud for microservices architecture
 
WDB005.1 - JavaScript for Java Developers (Lecture 1)
WDB005.1 - JavaScript for Java Developers (Lecture 1)WDB005.1 - JavaScript for Java Developers (Lecture 1)
WDB005.1 - JavaScript for Java Developers (Lecture 1)
 
Business value in game development
Business value in game developmentBusiness value in game development
Business value in game development
 
Cassandra Prophecy
Cassandra ProphecyCassandra Prophecy
Cassandra Prophecy
 
Gradle - next generation of build tools
Gradle - next generation of build toolsGradle - next generation of build tools
Gradle - next generation of build tools
 
XML Magic
XML MagicXML Magic
XML Magic
 
Igor Khotin - Domain Specific Languages
Igor Khotin - Domain Specific LanguagesIgor Khotin - Domain Specific Languages
Igor Khotin - Domain Specific Languages
 

Recently uploaded

Introduction to phyton , important topic
Introduction to phyton , important topicIntroduction to phyton , important topic
Introduction to phyton , important topicakpgenious67
 
Application deck- Cyril Caudroy-2024.pdf
Application deck- Cyril Caudroy-2024.pdfApplication deck- Cyril Caudroy-2024.pdf
Application deck- Cyril Caudroy-2024.pdfCyril CAUDROY
 
Digital Marketing Training Institute in Mohali, India
Digital Marketing Training Institute in Mohali, IndiaDigital Marketing Training Institute in Mohali, India
Digital Marketing Training Institute in Mohali, IndiaDigital Discovery Institute
 
ME 205- Chapter 6 - Pure Bending of Beams.pdf
ME 205- Chapter 6 - Pure Bending of Beams.pdfME 205- Chapter 6 - Pure Bending of Beams.pdf
ME 205- Chapter 6 - Pure Bending of Beams.pdfaae4149584
 
Storytelling, Ethics and Workflow in Documentary Photography
Storytelling, Ethics and Workflow in Documentary PhotographyStorytelling, Ethics and Workflow in Documentary Photography
Storytelling, Ethics and Workflow in Documentary PhotographyOrtega Alikwe
 
AICTE PPT slide of Engineering college kr pete
AICTE PPT slide of Engineering college kr peteAICTE PPT slide of Engineering college kr pete
AICTE PPT slide of Engineering college kr peteshivubhavv
 
办理学位证(Massey证书)新西兰梅西大学毕业证成绩单原版一比一
办理学位证(Massey证书)新西兰梅西大学毕业证成绩单原版一比一办理学位证(Massey证书)新西兰梅西大学毕业证成绩单原版一比一
办理学位证(Massey证书)新西兰梅西大学毕业证成绩单原版一比一A SSS
 
定制(SCU毕业证书)南十字星大学毕业证成绩单原版一比一
定制(SCU毕业证书)南十字星大学毕业证成绩单原版一比一定制(SCU毕业证书)南十字星大学毕业证成绩单原版一比一
定制(SCU毕业证书)南十字星大学毕业证成绩单原版一比一z xss
 
Protection of Children in context of IHL and Counter Terrorism
Protection of Children in context of IHL and  Counter TerrorismProtection of Children in context of IHL and  Counter Terrorism
Protection of Children in context of IHL and Counter TerrorismNilendra Kumar
 
原版定制卡尔加里大学毕业证(UC毕业证)留信学历认证
原版定制卡尔加里大学毕业证(UC毕业证)留信学历认证原版定制卡尔加里大学毕业证(UC毕业证)留信学历认证
原版定制卡尔加里大学毕业证(UC毕业证)留信学历认证diploma001
 
原版定制copy澳洲查尔斯达尔文大学毕业证CDU毕业证成绩单留信学历认证保障质量
原版定制copy澳洲查尔斯达尔文大学毕业证CDU毕业证成绩单留信学历认证保障质量原版定制copy澳洲查尔斯达尔文大学毕业证CDU毕业证成绩单留信学历认证保障质量
原版定制copy澳洲查尔斯达尔文大学毕业证CDU毕业证成绩单留信学历认证保障质量sehgh15heh
 
办理学位证(UoM证书)北安普顿大学毕业证成绩单原版一比一
办理学位证(UoM证书)北安普顿大学毕业证成绩单原版一比一办理学位证(UoM证书)北安普顿大学毕业证成绩单原版一比一
办理学位证(UoM证书)北安普顿大学毕业证成绩单原版一比一A SSS
 
8377877756 Full Enjoy @24/7 Call Girls in Pitampura Delhi NCR
8377877756 Full Enjoy @24/7 Call Girls in Pitampura Delhi NCR8377877756 Full Enjoy @24/7 Call Girls in Pitampura Delhi NCR
8377877756 Full Enjoy @24/7 Call Girls in Pitampura Delhi NCRdollysharma2066
 
Introduction to Political Parties (1).ppt
Introduction to Political Parties (1).pptIntroduction to Political Parties (1).ppt
Introduction to Political Parties (1).pptSohamChavan9
 
Nathan_Baughman_Resume_copywriter_and_editor
Nathan_Baughman_Resume_copywriter_and_editorNathan_Baughman_Resume_copywriter_and_editor
Nathan_Baughman_Resume_copywriter_and_editorNathanBaughman3
 
Black and White Minimalist Co Letter.pdf
Black and White Minimalist Co Letter.pdfBlack and White Minimalist Co Letter.pdf
Black and White Minimalist Co Letter.pdfpadillaangelina0023
 
办理哈珀亚当斯大学学院毕业证书文凭学位证书
办理哈珀亚当斯大学学院毕业证书文凭学位证书办理哈珀亚当斯大学学院毕业证书文凭学位证书
办理哈珀亚当斯大学学院毕业证书文凭学位证书saphesg8
 
Human Rights are notes and helping material
Human Rights are notes and helping materialHuman Rights are notes and helping material
Human Rights are notes and helping materialnadeemcollege26
 
定制(UQ毕业证书)澳洲昆士兰大学毕业证成绩单原版一比一
定制(UQ毕业证书)澳洲昆士兰大学毕业证成绩单原版一比一定制(UQ毕业证书)澳洲昆士兰大学毕业证成绩单原版一比一
定制(UQ毕业证书)澳洲昆士兰大学毕业证成绩单原版一比一lvtagr7
 
Back on Track: Navigating the Return to Work after Parental Leave
Back on Track: Navigating the Return to Work after Parental LeaveBack on Track: Navigating the Return to Work after Parental Leave
Back on Track: Navigating the Return to Work after Parental LeaveMarharyta Nedzelska
 

Recently uploaded (20)

Introduction to phyton , important topic
Introduction to phyton , important topicIntroduction to phyton , important topic
Introduction to phyton , important topic
 
Application deck- Cyril Caudroy-2024.pdf
Application deck- Cyril Caudroy-2024.pdfApplication deck- Cyril Caudroy-2024.pdf
Application deck- Cyril Caudroy-2024.pdf
 
Digital Marketing Training Institute in Mohali, India
Digital Marketing Training Institute in Mohali, IndiaDigital Marketing Training Institute in Mohali, India
Digital Marketing Training Institute in Mohali, India
 
ME 205- Chapter 6 - Pure Bending of Beams.pdf
ME 205- Chapter 6 - Pure Bending of Beams.pdfME 205- Chapter 6 - Pure Bending of Beams.pdf
ME 205- Chapter 6 - Pure Bending of Beams.pdf
 
Storytelling, Ethics and Workflow in Documentary Photography
Storytelling, Ethics and Workflow in Documentary PhotographyStorytelling, Ethics and Workflow in Documentary Photography
Storytelling, Ethics and Workflow in Documentary Photography
 
AICTE PPT slide of Engineering college kr pete
AICTE PPT slide of Engineering college kr peteAICTE PPT slide of Engineering college kr pete
AICTE PPT slide of Engineering college kr pete
 
办理学位证(Massey证书)新西兰梅西大学毕业证成绩单原版一比一
办理学位证(Massey证书)新西兰梅西大学毕业证成绩单原版一比一办理学位证(Massey证书)新西兰梅西大学毕业证成绩单原版一比一
办理学位证(Massey证书)新西兰梅西大学毕业证成绩单原版一比一
 
定制(SCU毕业证书)南十字星大学毕业证成绩单原版一比一
定制(SCU毕业证书)南十字星大学毕业证成绩单原版一比一定制(SCU毕业证书)南十字星大学毕业证成绩单原版一比一
定制(SCU毕业证书)南十字星大学毕业证成绩单原版一比一
 
Protection of Children in context of IHL and Counter Terrorism
Protection of Children in context of IHL and  Counter TerrorismProtection of Children in context of IHL and  Counter Terrorism
Protection of Children in context of IHL and Counter Terrorism
 
原版定制卡尔加里大学毕业证(UC毕业证)留信学历认证
原版定制卡尔加里大学毕业证(UC毕业证)留信学历认证原版定制卡尔加里大学毕业证(UC毕业证)留信学历认证
原版定制卡尔加里大学毕业证(UC毕业证)留信学历认证
 
原版定制copy澳洲查尔斯达尔文大学毕业证CDU毕业证成绩单留信学历认证保障质量
原版定制copy澳洲查尔斯达尔文大学毕业证CDU毕业证成绩单留信学历认证保障质量原版定制copy澳洲查尔斯达尔文大学毕业证CDU毕业证成绩单留信学历认证保障质量
原版定制copy澳洲查尔斯达尔文大学毕业证CDU毕业证成绩单留信学历认证保障质量
 
办理学位证(UoM证书)北安普顿大学毕业证成绩单原版一比一
办理学位证(UoM证书)北安普顿大学毕业证成绩单原版一比一办理学位证(UoM证书)北安普顿大学毕业证成绩单原版一比一
办理学位证(UoM证书)北安普顿大学毕业证成绩单原版一比一
 
8377877756 Full Enjoy @24/7 Call Girls in Pitampura Delhi NCR
8377877756 Full Enjoy @24/7 Call Girls in Pitampura Delhi NCR8377877756 Full Enjoy @24/7 Call Girls in Pitampura Delhi NCR
8377877756 Full Enjoy @24/7 Call Girls in Pitampura Delhi NCR
 
Introduction to Political Parties (1).ppt
Introduction to Political Parties (1).pptIntroduction to Political Parties (1).ppt
Introduction to Political Parties (1).ppt
 
Nathan_Baughman_Resume_copywriter_and_editor
Nathan_Baughman_Resume_copywriter_and_editorNathan_Baughman_Resume_copywriter_and_editor
Nathan_Baughman_Resume_copywriter_and_editor
 
Black and White Minimalist Co Letter.pdf
Black and White Minimalist Co Letter.pdfBlack and White Minimalist Co Letter.pdf
Black and White Minimalist Co Letter.pdf
 
办理哈珀亚当斯大学学院毕业证书文凭学位证书
办理哈珀亚当斯大学学院毕业证书文凭学位证书办理哈珀亚当斯大学学院毕业证书文凭学位证书
办理哈珀亚当斯大学学院毕业证书文凭学位证书
 
Human Rights are notes and helping material
Human Rights are notes and helping materialHuman Rights are notes and helping material
Human Rights are notes and helping material
 
定制(UQ毕业证书)澳洲昆士兰大学毕业证成绩单原版一比一
定制(UQ毕业证书)澳洲昆士兰大学毕业证成绩单原版一比一定制(UQ毕业证书)澳洲昆士兰大学毕业证成绩单原版一比一
定制(UQ毕业证书)澳洲昆士兰大学毕业证成绩单原版一比一
 
Back on Track: Navigating the Return to Work after Parental Leave
Back on Track: Navigating the Return to Work after Parental LeaveBack on Track: Navigating the Return to Work after Parental Leave
Back on Track: Navigating the Return to Work after Parental Leave
 

Gradle - time for a new build

  • 1. Gradle time for a new build! time for a new build Igor Khotin E-mail: khotin@gmx.com
  • 2. Background ● 12+ years in the IT industry ● 7+ years with Java ● Flexible design promoter ● Agile-junkie
  • 3. What do we use? ● Ant? ● Maven? ● Buildr? ● Gradle? ● ...
  • 4. Any problems? ● heavy builds? ● long integration cycles? ● build projects support? ● build projects integration? ● ...
  • 5.
  • 6. How we used to build?
  • 8. give them to an operator
  • 13. 2000
  • 14. ant Complexity
  • 15. ant Complexity hard to reuse
  • 16. ant Complexity hard to reuse heavy build.xml's
  • 17. ant Complexity hard to reuse heavy build.xml's Total Control
  • 18. 2001
  • 19. maven convention over configuration
  • 20. maven maven central convention over configuration
  • 21. maven maven central convention over configuration dependency management
  • 22. maven heavy xml's maven central convention over configuration dependency management
  • 23. maven heavy xml's hard to implement custom behavior maven central convention over configuration dependency management
  • 24. maven heavy xml's hard to implement custom behavior maven central convention over configuration dependency management lost control
  • 25. Gradle yesterday ● Founder - Hans Dockter ● 2008 – early releases ● 2010 Springy Innovation Award
  • 26. Gradle today ● 1.0-rc2 released on April 25, 2012 ● Active community ● Gradleware ● Apache License, Version 2.0
  • 27.
  • 28.
  • 30. Who is that Gradle? ● Build integration tool ● Declarative builds ● Groovy-based build DSL ● Build-by-convention
  • 31. Who is that Gradle? ● Scalable – multi-project builds ● Dependency management ● Ease of migration ● Embeddable ● Deep API
  • 33. Groovy and Gradle build.gradle task count << { 4.times { print "$it " } } > gradle -q count 0 1 2 3
  • 34. gradle task != ant task gradle task == ant target
  • 36. Dependencies task build << { println 'building...' } task count(dependsOn: build) << { 4.times { print "$it " } } > gradle -q count building... 0 1 2 3
  • 37. Lazy dependencies task build(dependsOn: 'lazy') << { println 'building...' } task lazy << { println 'so lazy...' } > gradle -q hello so lazy... building...
  • 38. Rules build.gradle tasks.addRule("Pattern: ping<ID>") { String taskName -> if (taskName.startsWith("ping")) { task(taskName) << { println "Pinging: " + (taskName - 'ping') } } } task groupPing { dependsOn pingServer1, pingServer2 } > gradle -q groupPing Pinging: Server1 Pinging: Server2
  • 39. Gradle Plugins tasks – objects – conventions
  • 40. Gradle Plugins java scala groovy cpp antrl checkstyle findbugs pmd sonar ear war osgi jetty maven
  • 41. Java Plugin build.gradle apply plugin: 'java' > gradle build ...
  • 42. Java Plugin Folder Layout src/main/java Production Java source src/main/resources Production resources src/test/java Test Java source src/test/resources Test resources just like maven...
  • 44. Java Plugin Tasks Flow { println 'injecting...' } Injectable with Groovy closures
  • 45. Java build-cycle customization apply plugin: 'java' test.doFirst { println 'Before testing...' } test.doLast { println '...after testing.' }
  • 46. Dependency management ● You can define rules for dependencies ● Flexible repository handling ● Works with Ivy and Maven repositories ● Dynamic properties ● and more...
  • 47. Java & jars apply plugin: 'java' repositories { mavenCentral() } dependencies { compile 'commons-lang:commons-lang:2.5' testCompile 'junit:junit:4.8.1' }
  • 48. Ant ant.importBuild 'build.xml' task ant << { ant.echo(message: 'hello from Ant') ant.zip(destfile: 'archive.zip') { fileset(dir: 'src') { include(name: '**.xml') exclude(name: '**.java') } } }
  • 49. Build Lifecycle Initialization Configuration Execution
  • 50. Multi-project builds ● Arbitrary multi-project layout ● Configuration injection ● Separate config/execution tree ● Partial builds
  • 51. Multi-project builds include 'project1', 'project2' root-project/ build.gradle settings.gradle project1/ build.gradle project2/ build.gradle
  • 52. Gradle daemon ● To reduce the startup time ● Used in STS Gradle plugin for Eclipse ● Used in Intellij IDEA plugin (IDEA>10) ● Used by default in Tooling API
  • 53. Apache Ant vs. Apache Maven vs. Gradle
  • 54. ant <?xml version="1.0"?> <project name="simple" default="dist" basedir="."> <property name="src" location="src/main/java"/> <property name="srcTest" location="src/test/java"/> <property name="build" location="build"/> <property name="dist" location="${build}/lib"/> <property name="version" value="1.0-SNAPSHOT" /> <path id="classpath.compile"> <pathelement location="libs/commons-lang-2.5.jar"/> </path> <path id="classpath.test"> <pathelement location="libs/junit-4.8.2.jar"/> <pathelement location="libs/commons-lang-2.5.jar"/> <pathelement location="${srcTest}"/> <pathelement location="${build}/classes"/> <pathelement location="${build}/test-classes"/> </path> ...
  • 55. ant ... <target name="init"> <mkdir dir="${build}/classes"/> <mkdir dir="${build}/test-classes"/> </target> <target name="compile" depends="init"> <javac srcdir="${src}" destdir="${build}/classes"> <classpath refid="classpath.compile"/> </javac> </target> <target name="testCompile" depends="compile"> <javac srcdir="${srcTest}" destdir="${build}/test-classes"> <classpath refid="classpath.test"/> </javac> </target> ...
  • 56. ant ... <target name="test" depends="testCompile"> <junit fork="yes" haltonfailure="yes"> <batchtest fork="yes"> <fileset dir="${srcTest}"> <include name="**/*Test.java"/> </fileset> </batchtest> <classpath refid="classpath.test"/> <formatter type="plain"/> </junit> </target> <target name="dist" depends="test"> <mkdir dir="${dist}"/> <jar jarfile="${dist}/coc-comparison-${version}.jar" basedir="${build}/classes"/> </target> <target name="clean"><delete dir="${build}"/></target> </project>
  • 57. maven <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>grId</groupId> <artifactId>coc-comparison</artifactId> <packaging>jar</packaging> <version>1.0-SNAPSHOT</version> ...
  • 58. maven ... <dependencies> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.5</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.8.1</version> <scope>test</scope> </dependency> </dependencies> </project>
  • 59. polyglot maven project { modelVersion '4.0.0' artifactId 'coc-comparison' groupId 'grId' version '1.0-SNAPSHOT' dependencies { dependency('commons-lang:commons-lang:2.5') dependency('junit:junit:4.8.1') } properties { 'maven.compiler.target' '1.6' 'maven.compiler.source' '1.6' } }
  • 60. gradle apply plugin: 'java' version="1.0-SNAPSHOT" group="grId" archivesBaseName="coc-comparison" repositories { mavenCentral() } dependencies { compile 'commons-lang:commons-lang:2.5' testCompile 'junit:junit:4.8.1' }
  • 65. Gradle tomorrow ● Release 1.0 till the end of 2012 ● Deep import of maven projects ● Release management ● Smart testing ● Archetypes?
  • 66.
  • 67. Resources ● gradle.org ● groovy.codehaus.org ● sonatype.org ● ant.apache.org/ivy
  • 69. Contacts Igor Khotin E-mail: khotin@gmx.com Blog: www.ikhotin.com Twitter: chaostarter