Gradle build automation tool
Transcript of Gradle build automation tool
![Page 1: Gradle build automation tool](https://reader035.fdocuments.us/reader035/viewer/2022071705/55a2c6551a28ab61158b47ac/html5/thumbnails/1.jpg)
Gradlebuild automation tool
BJUG #27, november 2014Ioan Eugen Stan
![Page 2: Gradle build automation tool](https://reader035.fdocuments.us/reader035/viewer/2022071705/55a2c6551a28ab61158b47ac/html5/thumbnails/2.jpg)
About me
● independent IT Consultant (Java, Architecture)● Open Source Hacker● Web: http://ieugen.ro/● http://github.com/ieugen● @ieugen222Code: https://github.com/ieugen/bjug27-gradle-intro
![Page 3: Gradle build automation tool](https://reader035.fdocuments.us/reader035/viewer/2022071705/55a2c6551a28ab61158b47ac/html5/thumbnails/3.jpg)
Software development = creativity + lots of
repetive tasks
![Page 4: Gradle build automation tool](https://reader035.fdocuments.us/reader035/viewer/2022071705/55a2c6551a28ab61158b47ac/html5/thumbnails/4.jpg)
We hate repetitive tasks !!
![Page 5: Gradle build automation tool](https://reader035.fdocuments.us/reader035/viewer/2022071705/55a2c6551a28ab61158b47ac/html5/thumbnails/5.jpg)
We invented build tools ;)
![Page 6: Gradle build automation tool](https://reader035.fdocuments.us/reader035/viewer/2022071705/55a2c6551a28ab61158b47ac/html5/thumbnails/6.jpg)
A bit of build tool history
● shell scripts● simple tools: make, ant, etc ● tools with lifecycle: maven, gradle, etc.
![Page 7: Gradle build automation tool](https://reader035.fdocuments.us/reader035/viewer/2022071705/55a2c6551a28ab61158b47ac/html5/thumbnails/7.jpg)
Apache Ant
● like make, java oriented, multi-platform● has limited assumptions of build
environment● very flexible● imperative (no conventions)● lots of repetition● complex builds are hard to maintain● xml based configuration file
![Page 8: Gradle build automation tool](https://reader035.fdocuments.us/reader035/viewer/2022071705/55a2c6551a28ab61158b47ac/html5/thumbnails/8.jpg)
Apache Maven
● opinionated about the build lifecycle● introduced Convention over Configuration● strict lifecycle● java centric● limited flexibility in configuration● xml based configuration
![Page 9: Gradle build automation tool](https://reader035.fdocuments.us/reader035/viewer/2022071705/55a2c6551a28ab61158b47ac/html5/thumbnails/9.jpg)
Gradle● gradle uses build scripts: build.gradle● every build is a Groovy script● embraces Convention over Configuration and Don’t
Repeat Yourself● (almost) everything is convention and can be changed● creates a dynamic model of the workflow as a Directed
Acyclic Graph ~ DAG
![Page 10: Gradle build automation tool](https://reader035.fdocuments.us/reader035/viewer/2022071705/55a2c6551a28ab61158b47ac/html5/thumbnails/10.jpg)
Gradle features● declarative builds and build-by-convention● DSL for dependency based programming● structures your build● multi-project builds● gradle wrapper● build daemon - speeds build● many ways to manage dependencies● free and open-source
![Page 11: Gradle build automation tool](https://reader035.fdocuments.us/reader035/viewer/2022071705/55a2c6551a28ab61158b47ac/html5/thumbnails/11.jpg)
Maven build lifecycle - very strict
http://opensourceforgeeks.blogspot.ro/2014/01/building-java-projects-with-maven.html
![Page 12: Gradle build automation tool](https://reader035.fdocuments.us/reader035/viewer/2022071705/55a2c6551a28ab61158b47ac/html5/thumbnails/12.jpg)
Gradle build lifecycle
● Initialization○ identifies project to build○ creates Project instance
● Configuration○ executes buildscript{} for all its scope○ configures the project objects
● Execution○ creates the Task DAG○ runs the build
![Page 13: Gradle build automation tool](https://reader035.fdocuments.us/reader035/viewer/2022071705/55a2c6551a28ab61158b47ac/html5/thumbnails/13.jpg)
Task graphs (DAGs) java-plugin
![Page 14: Gradle build automation tool](https://reader035.fdocuments.us/reader035/viewer/2022071705/55a2c6551a28ab61158b47ac/html5/thumbnails/14.jpg)
Gradle Task
● single atomic piece of work for a build● belongs to a project● has properties● has a list of Actions
Invocation: gradle taskName
![Page 15: Gradle build automation tool](https://reader035.fdocuments.us/reader035/viewer/2022071705/55a2c6551a28ab61158b47ac/html5/thumbnails/15.jpg)
Dependencies code + demo
![Page 16: Gradle build automation tool](https://reader035.fdocuments.us/reader035/viewer/2022071705/55a2c6551a28ab61158b47ac/html5/thumbnails/16.jpg)
Build Daemoncode + demo
![Page 17: Gradle build automation tool](https://reader035.fdocuments.us/reader035/viewer/2022071705/55a2c6551a28ab61158b47ac/html5/thumbnails/17.jpg)
Usefull gradle pluginsCheck http://plugins.gradle.org/
and http://www.gradle.org/docs/current/userguide/standard_plugins
.html
![Page 18: Gradle build automation tool](https://reader035.fdocuments.us/reader035/viewer/2022071705/55a2c6551a28ab61158b47ac/html5/thumbnails/18.jpg)
References● Code: https://github.com/ieugen/bjug27-gradle-intro● UserGuide http://www.gradle.org/docs/current/userguide/userguide.html● DSL Reference http://www.gradle.org/docs/current/dsl/● Rocking the Gradle https://www.youtube.com/watch?v=5a91dBLX8Qc● Gradle intro https://www.youtube.com/watch?v=hvMKpQqo2ts