This document summarizes the key points about Gradle build automation tool. It discusses some limitations of Ant and Maven, how Gradle addresses them using Groovy as its configuration language. Gradle provides features like caching, daemon, plugins, and integration with Maven. It offers better performance than Maven for multi-project builds. The document compares Gradle and Maven build times on sample projects and outlines some pros and cons of Gradle.
2. About author
• Works in IT since 2000
• 11 year of Java SE/EE experience
• Regular speaker at Java conferences
• Author of “Development of Java applications” and
“Main errors in Java programming ”books
• Founder of http://it-simulator.com
• 3 years of Gradle usage
29. 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
30. 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
31. Slogan
• Make the impossible possible
• Make the possible easy
• Make the easy elegant
32. 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
• Share base syntax, type system, packages
hierarchy with Java
• Every Gradle build file is Groovy script
44. 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
48. Cache everything
• Remote metadata and artifacts
• Transitive dependency resolution
• Build execution plan
• Plugin inputs and outputs
• Test results
49. Daemon
• Improves startup and execution time of Gradle
• Initial Gradle command forks daemon process
• Subsequent Gradle commands reuse the build
daemon
• If daemon is currently busy then new daemon
process is started on-demand
• Useful for small tasks execution
• Expires after 3 hours of idle time
65. Maven converter
• maven2Gradle is obsolete now
• Build init plugin converts:
o POM settings
o Dependencies
o Properties
o Java compiler settings
o Single- and multi-project settings
o Packaging of sources and tests
75. 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
76. Wrapper
• Preferred way of starting a Gradle build
• Gradle will be automatically downloaded via
wrapper
• Includes shell script
• Useful for CI tasks
77.
78. Pros
• Native Java/Scala/Groovy support
• Ant/Maven/Ivy integration
• Full IDE support
• Flexible DSL
• Multiple third-party plugins(70+)
• Declarative & imperative approaches
• Rapid development
• Performance
79. Cons
• Compilation & run-time issues
• Larger learning curve
• Less community & industry support