Gradle and Maven
Table of contents
Gradle and Maven are build automation tools that are designed to be flexible enough to build almost any type of software, ranging from mobile application to web applications and command line applications.
- Gradle (https://gradle.org/)
- Maven (http://maven.apache.org/)
According to Google Trends, Maven is the most popular build tool.
Advantages of Gradle over Maven
Flexible
Changing the build lifecycle using Maven is harder than expected. Gradle addressed this and made it easy to customise the lifecycles as required (reference).
Performant
Better Dependency Management
Maven allows one to override a dependency, but only by their version. Gradle provides customizable dependency selection and substitution rules that can be declared once and handle unwanted dependencies project-wide. This substitution mechanism enables Gradle to build multiple source projects together to create composite builds (reference).
Install Gradle
Install
Either using
SDKMAN
$ sdk install gradle 6.3
or using
brew
$ brew install gradle
Verify
```bash $ gradle -version
Gradle 6.3 ————————————————————
Build time: 2020-03-24 19:52:07 UTC Revision: bacd40b727b0130eeac8855ae3f9fd9a0b207c60
Kotlin: 1.3.70 Groovy: 2.5.10 Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019 JVM: 14.0.1 (AdoptOpenJDK 14.0.1+7) OS: Mac OS X 10.15.4 x86_64 ```
For more details, please refer to: https://gradle.org/install/.
Recommended reading
- Gradle in Action (O’Reilly Books)
- Gradle Beyond the Basics (O’Reilly Books)
- Building and Testing with Gradle (O’Reilly Books)
- Gradle Fundamentals (O’Reilly Video Series)