Gradle
Upcoming SlideShare
Loading in...5
×
 

Gradle

on

  • 1,259 views

Experience report from porting an Ant and a Maven project to Gradle. Held at javaBin 5. October 2011.

Experience report from porting an Ant and a Maven project to Gradle. Held at javaBin 5. October 2011.

The slides give an overview of the content.

Statistics

Views

Total Views
1,259
Views on SlideShare
1,259
Embed Views
0

Actions

Likes
0
Downloads
31
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Gradle Gradle Document Transcript

  • gradle Thor Åge EldbyMonday, November 21, 2011 1
  • Thor Åge Eldby @thoraageeldby Arktekk 2Monday, November 21, 2011 22.5 år in Arktekk16 år in system development
  • Build Systems make sbt 3Monday, November 21, 2011 3Make, batch-files (COS,Steinar Haugen,Kenneth Stigen)ant -> can compile javamaven -> conventions, dependenciessbt and now gradle View slide
  • What: Repeatable ear ear ear ear 4Monday, November 21, 2011 4Independent from host, platform, timeAll information in build scripts•How•What•Externals-Ant View slide
  • What: Flexible 5Monday, November 21, 2011 5Possible to buildSimple-Maven, Ant
  • What: Readable 6Monday, November 21, 2011 6Not a black boxDiffableGUI is not
  • What: Conventions 7Monday, November 21, 2011 7RecognisableStructuresCommands-Ant
  • 8Monday, November 21, 2011 8RepeatableFlexible - Groovy (and ant) building DSLReadableConventions - Follows maven structure partlySystemised, programmable ant
  • Simple Example apply plugin: java repositories { mavenCentral() } dependencies { compile com.google.guava:guava:r08 } 9Monday, November 21, 2011 9Needed to compile java code into jarBuild DSLScript blocks (many)
  • Plugin apply plugin: java repositories { mavenCentral() } dependencies { compile com.google.guava:guava:r08 } 10Monday, November 21, 2011 10Interpreted script
  • Dependencies apply plugin: java repositories { mavenCentral() } dependencies { compile com.google.guava:guava:r08 } 11Monday, November 21, 2011 11Configuration like scope in maven... and classpath in ant
  • Dependencies apply plugin: java repositories { dependencies { mavenCentral() compile project(:common) } } dependencies { compile com.google.guava:guava:r08 } 11Monday, November 21, 2011 11Configuration like scope in maven... and classpath in ant
  • Dependencies apply plugin: java repositories { dependencies { dependencies { mavenCentral() testCompile group: junit, name: junit, compile project(:common) } version: 4.+ } } dependencies { compile com.google.guava:guava:r08 } 11Monday, November 21, 2011 11Configuration like scope in maven... and classpath in ant
  • Dependencies apply plugin: java dependencies { repositories { dependencies { dependencies { compile(org.hibernate:hibernate:3.0.5) { mavenCentral() testCompile group: junit, name: junit, compile project(:common) transitive = false } version: 4.+ } } } dependencies { } compile com.google.guava:guava:r08 } 11Monday, November 21, 2011 11Configuration like scope in maven... and classpath in ant
  • Dependencies apply plugin: java dependencies { repositories { dependencies { dependencies { compile(org.hibernate:hibernate:3.0.5) { runtime files(libs/a.jar, libs/b.jar) mavenCentral() testCompile group: junit, name: junit, runtime fileTree(dir: libs, compile project(:common) transitive = false } version: 4.+ } } include: *.jar) } dependencies { } compile com.google.guava:guava:r08 } 11Monday, November 21, 2011 11Configuration like scope in maven... and classpath in ant
  • Dependencies apply plugin: java dependencies { repositories { dependencies { dependencies { compile(org.hibernate:hibernate:3.0.5) { testCompile(org.testng:testng:6.2.1) { runtime files(libs/a.jar, libs/b.jar) mavenCentral() testCompile group: junit, name: junit, runtime fileTree(dir: libs, compile project(:common) transitive = false exclude module: guice } version: 4.+ } } include: *.jar) } dependencies { } compile com.google.guava:guava:r08 } 11Monday, November 21, 2011 11Configuration like scope in maven... and classpath in ant
  • Repositories apply plugin: java repositories { mavenCentral() } dependencies { compile com.google.guava:guava:r08 } 12Monday, November 21, 2011 12
  • Repositories apply plugin: java repositories { repositories { mavenCentral() mavenRepo urls: "http://repo.my.com/maven2" } } dependencies { compile com.google.guava:guava:r08 } 12Monday, November 21, 2011 12
  • Repositories apply plugin: java repositories { repositories { mavenCentral() mavenLocal() mavenRepo urls: "http://repo.my.com/maven2" } } dependencies { compile com.google.guava:guava:r08 } 12Monday, November 21, 2011 12
  • Repositories apply plugin: java repositories { repositories { repositories { flatDir { mavenCentral() mavenLocal() mavenRepo urls: "http://repo.my.com/maven2" dirs lib } } } dependencies { } compile com.google.guava:guava:r08 } 12Monday, November 21, 2011 12
  • Repositories apply plugin: java repositories { repositories { repositories { ivy { repositories { flatDir { mavenCentral() url "http://repo.mycompany.com/repo" mavenLocal() mavenRepo urls: "http://repo.my.com/maven2" dirs lib } layout "maven" } } } dependencies { } } compile com.google.guava:guava:r08 } 12Monday, November 21, 2011 12
  • Coding It apply plugin: java repositories { mavenCentral() } dependencies { compile com.google.guava:guava:r08 } 13Monday, November 21, 2011 13Tasks (like ant targets)•Depends onRepositories•Uses mavenConfigurations (like maven scopes)Building simple example without pluginsCompile java and jar itKeeping out testing and all the other stuffPrefer functions over tasks
  • Coding It apply plugin: java repositories { mavenCentral() } dependencies { compile com.google.guava:guava:r08 } 13Monday, November 21, 2011 13Tasks (like ant targets)•Depends onRepositories•Uses mavenConfigurations (like maven scopes)Building simple example without pluginsCompile java and jar itKeeping out testing and all the other stuffPrefer functions over tasks
  • Multi Project myproject api common web 14Monday, November 21, 2011 14
  • Multi Project settings.gradle include common, api, web 15Monday, November 21, 2011 15Settings object - Including multiprojects
  • Multi Project settings.gradle include common, api, web def subs(project) { def children = project.children children + children.collect { subs(it) } } subs(rootProject).flatten().each { it.buildFileName = "${it.name}.gradle" } 15Monday, November 21, 2011 15Settings object - Including multiprojects
  • Multi Project build.gradle subprojects { apply plugin: java repositories { mavenRepo urls: http://here } dependencies { compile com.google.guava:guava:10.0 } } 16Monday, November 21, 2011 16
  • Multi Project build.gradle subprojects { apply plugin: java repositories { mavenRepo urls: http://here allprojects { ... } } dependencies { compile com.google.guava:guava:10.0 } } 16Monday, November 21, 2011 16
  • Multi Project build.gradle subprojects { apply plugin: java repositories { mavenRepo urls: http://here project(‘:common’) { allprojects { ... } } dependencies { compile com.google.guava:guava:10.0 } } 16Monday, November 21, 2011 16
  • Multi Project common/common.gradle 17Monday, November 21, 2011 17Empty -> Remove
  • Multi Project common/common.gradle 17Monday, November 21, 2011 17Empty -> Remove
  • Multi Project api/api.gradle dependencies { compile project(‘:common’) } 18Monday, November 21, 2011 18
  • Multi Project web/web.gradle apply plugin: ‘war’ dependencies { compile project(‘:api’) } war { webAppDir file(‘src/main/webapp’) } 19Monday, November 21, 2011 19
  • Multi Project myproject api common web 20Monday, November 21, 2011 20Built alphabeticallyUnless dependenciesCross module dependencies•Single cmd to draw out result
  • Multi Project myproject api common web 20Monday, November 21, 2011 20Built alphabeticallyUnless dependenciesCross module dependencies•Single cmd to draw out result
  • Multi Project myproject common api web 20Monday, November 21, 2011 20Built alphabeticallyUnless dependenciesCross module dependencies•Single cmd to draw out result
  • Plugin Support 21Monday, November 21, 2011 21Maven plugin (uploads artifacts)Eclipse/Idea plugin•Never get the maven integration, nothing can be said before all config is loadedJava / Groovy / ScalaWar / Ear / Antlr / Announce / Application / JettySonar / Project Report / Code QualityMore on github
  • Writing Own Plugins 22Monday, November 21, 2011 221.Hack it together2.Copy it3.Create a plugin
  • IDE Support 23Monday, November 21, 2011 23Plugins for Idea and EclipseIdea functions very wellNot for gradle code: Gradle support in Idea 11Netbeans being worked on (by Oracle)
  • IDE Support 23Monday, November 21, 2011 23Plugins for Idea and EclipseIdea functions very wellNot for gradle code: Gradle support in Idea 11Netbeans being worked on (by Oracle)
  • IDE Support 23Monday, November 21, 2011 23Plugins for Idea and EclipseIdea functions very wellNot for gradle code: Gradle support in Idea 11Netbeans being worked on (by Oracle)
  • IDE Support ? 23Monday, November 21, 2011 23Plugins for Idea and EclipseIdea functions very wellNot for gradle code: Gradle support in Idea 11Netbeans being worked on (by Oracle)
  • Performance 24Monday, November 21, 2011 24Generally OKLoads all configuration•Daemon may fix thisCalculates MD5 sums for inputs/outputs
  • Coming Attractions NEW 25Monday, November 21, 2011 25Release 0.1 @ April 2008A little immature, version 1.0m3 (1.0m4 withdrawn)1.0 milestone 5•Daemon (4)•EAR, Signing (4)•Experimental C++•Multi process safe caches
  • Conclusion 26Monday, November 21, 2011 26Strangeness:•Hard to test plugins•Low on documentation (search mailing-list)•Changes can be made to early or to late for the process•Silent when it’s unable to find a project artifact (due to missing dependencies)Perfect for reviving ant-projectsFlexible flexible flexible
  • :compileJava UP-TO-DATE :processResources UP-TO-DATE END :classes UP-TO-DATE :jar UP-TO-DATE :assemble UP-TO-DATE :compileTestJava UP-TO-DATE :processTestResources UP-TO-DATE :testClasses UP-TO-DATE :test UP-TO-DATE :check UP-TO-DATE :build UP-TO-DATE BUILD SUCCESSFUL Total time: 3233.278 secs 27Monday, November 21, 2011 27