expertalks: jul 2012 - build using gradle
DESCRIPTION
This presentation was part of EXPERTALKS: Jul 2012 conducted at Equal Experts India on 28th July 2012. Visit http://meetup.com/expertalks to know more... ------------------------------------------------------------------------------------- For quite a long time now, Build Automation on projects has been synonymous with 2 tools: Ant and Maven. While both tools are pretty effective & widely used, they have their share of shortcomings. GRADLE brings in the much needed evolution in build automation. Gradle combines the strengths of Maven and Ant resulting in a more effective way to build. Needless to say, it is the build tool of choice for us here at Equal Experts. ------------------------------------------------------------------------------------- This presentation talks about Gradle. The PPT also accompanied a workshop conducted as part of EXPERTALKS: Jul 2012TRANSCRIPT
![Page 2: EXPERTALKS: Jul 2012 - Build using Gradle](https://reader033.vdocuments.us/reader033/viewer/2022061223/54c60eab4a7959252f8b45c6/html5/thumbnails/2.jpg)
www.equalexperts.com
…a better way to build
![Page 3: EXPERTALKS: Jul 2012 - Build using Gradle](https://reader033.vdocuments.us/reader033/viewer/2022061223/54c60eab4a7959252f8b45c6/html5/thumbnails/3.jpg)
www.equalexperts.com
A simple build cycle
![Page 4: EXPERTALKS: Jul 2012 - Build using Gradle](https://reader033.vdocuments.us/reader033/viewer/2022061223/54c60eab4a7959252f8b45c6/html5/thumbnails/4.jpg)
www.equalexperts.com
Why Gradle?
Ant features: Maven features:A flexible tool Build by conventionXML scripts Dependency
managementBuild tasks
But these are not enough
What’s needed:• Sensible defaults yet easy customization• Readable and maintainable scripts• Faster builds• Easy scalability
![Page 5: EXPERTALKS: Jul 2012 - Build using Gradle](https://reader033.vdocuments.us/reader033/viewer/2022061223/54c60eab4a7959252f8b45c6/html5/thumbnails/5.jpg)
www.equalexperts.com
Gradle is:• Faster
• Concise
• Groovy DSL
• Flexible
• Programmable
• Integrates with Ant
• Supports Groovy and Scala
• Scalable
• Structured
• Open Source
![Page 6: EXPERTALKS: Jul 2012 - Build using Gradle](https://reader033.vdocuments.us/reader033/viewer/2022061223/54c60eab4a7959252f8b45c6/html5/thumbnails/6.jpg)
www.equalexperts.com
FasterIncremental builds make it faster.
![Page 7: EXPERTALKS: Jul 2012 - Build using Gradle](https://reader033.vdocuments.us/reader033/viewer/2022061223/54c60eab4a7959252f8b45c6/html5/thumbnails/7.jpg)
www.equalexperts.com
Concise – smaller scriptsbuild.gradleapply plugin : ’java’build.xml
![Page 8: EXPERTALKS: Jul 2012 - Build using Gradle](https://reader033.vdocuments.us/reader033/viewer/2022061223/54c60eab4a7959252f8b45c6/html5/thumbnails/8.jpg)
www.equalexperts.com
Groovy DSLDSL is more readable than XML
![Page 9: EXPERTALKS: Jul 2012 - Build using Gradle](https://reader033.vdocuments.us/reader033/viewer/2022061223/54c60eab4a7959252f8b45c6/html5/thumbnails/9.jpg)
www.equalexperts.com
FlexibleEasy to customize default behaviour
Here’s Gradle doing a specific customization…
![Page 10: EXPERTALKS: Jul 2012 - Build using Gradle](https://reader033.vdocuments.us/reader033/viewer/2022061223/54c60eab4a7959252f8b45c6/html5/thumbnails/10.jpg)
www.equalexperts.com
Maven doing that same customization…
![Page 11: EXPERTALKS: Jul 2012 - Build using Gradle](https://reader033.vdocuments.us/reader033/viewer/2022061223/54c60eab4a7959252f8b45c6/html5/thumbnails/11.jpg)
www.equalexperts.com
ProgrammableGo ahead and write your own tasks
![Page 12: EXPERTALKS: Jul 2012 - Build using Gradle](https://reader033.vdocuments.us/reader033/viewer/2022061223/54c60eab4a7959252f8b45c6/html5/thumbnails/12.jpg)
www.equalexperts.com
Integration with Ant
![Page 13: EXPERTALKS: Jul 2012 - Build using Gradle](https://reader033.vdocuments.us/reader033/viewer/2022061223/54c60eab4a7959252f8b45c6/html5/thumbnails/13.jpg)
www.equalexperts.com
Workshop Time !!!
![Page 14: EXPERTALKS: Jul 2012 - Build using Gradle](https://reader033.vdocuments.us/reader033/viewer/2022061223/54c60eab4a7959252f8b45c6/html5/thumbnails/14.jpg)
www.equalexperts.com
Heads Up…
Gradle setup
Hello World Gradle
More about Task
Build your Java project
Create your Jar
Manage dependency for JUnit
Create and deploy your War
Multi-project build
![Page 15: EXPERTALKS: Jul 2012 - Build using Gradle](https://reader033.vdocuments.us/reader033/viewer/2022061223/54c60eab4a7959252f8b45c6/html5/thumbnails/15.jpg)
www.equalexperts.com
Setup instructions
Installation
Environment Variables
• Requires JAVA_HOME
• Set GRADLE_HOME
• Add $GRADLE_HOME/bin to PATH
Run gradle -v
![Page 16: EXPERTALKS: Jul 2012 - Build using Gradle](https://reader033.vdocuments.us/reader033/viewer/2022061223/54c60eab4a7959252f8b45c6/html5/thumbnails/16.jpg)
www.equalexperts.com
Basic script
build.gradle
task hello << {
println ‘Hello World !’
}
![Page 17: EXPERTALKS: Jul 2012 - Build using Gradle](https://reader033.vdocuments.us/reader033/viewer/2022061223/54c60eab4a7959252f8b45c6/html5/thumbnails/17.jpg)
www.equalexperts.com
Find the examples on Git Hub:
https://github.com/Tejaswita/Tejaswita/tree/
master/Gradle_Introduction
![Page 18: EXPERTALKS: Jul 2012 - Build using Gradle](https://reader033.vdocuments.us/reader033/viewer/2022061223/54c60eab4a7959252f8b45c6/html5/thumbnails/18.jpg)
www.equalexperts.com
Forum:http://forums.gradle.org/gradle
References:http://gradle.org/documentation
http://gradle.org/docs/current/dsl/index.html
Building and Testing with Gradle – by Tim Berglund & Matthew McCullough
Gradle User Guide
![Page 19: EXPERTALKS: Jul 2012 - Build using Gradle](https://reader033.vdocuments.us/reader033/viewer/2022061223/54c60eab4a7959252f8b45c6/html5/thumbnails/19.jpg)
www.equalexperts.com
Take Away
A solution that provides convention over configuration approach to the build process and an approach at building that isn’t based
on XML