Gradle or Maven - A Dilemma
Gradle and Maven (or Both)
The world of build tools evolve from simple compilation (gcc) to make files, then evolution of ant(+ivy) and Maven, now the latest build tool is Gradle.
Its always a puzzle which build tool to choose maven, gradle or both (maven and gradle). Sometime its first time project setup or could be migration from existing tool but it always a debate to choose one of the existing one.
There have been lot of talks and discussion on Gradle, maven (and/or Gradle vs maven). There are Buzz around that Android/google adopted Gradle as its standard build tools.
Here, i would like to explore the possibilities of adopting Gradle or maven (Or Both), Intentionally i am keeping ant+ivy out of this talk.
Lets take a look in details on why android adopted gradle
Key points for the google to go ahead with gradle for their android development are
- Create multiple APKs for your app with different features using the same project.(create several variants of an application)
- Reuse code and resources.
- Customize, configure, and extend the build process.
- Customized integration with their own IDE Android Studio.
- Single build tools to support multiple languages.
They had some special requirements for their diverse eco system, they worked with gradleware development team to include customized feature for the android application. They even have customized IDE for android Developers build around gradle.
What are we may be looking from Build tools
- How easy is the learning curve?
- How fast are different builds with each tool?
- How complex is it to create and maintain the build script?
- How many plugins exist and how simple is it to customize your own plugins?
- How good is the community and documentation for each tool?
- How well does each tool integrate with developer tools? (IDE, App Server, CI server).
Lets take a look at Maven and Gradle build tool on basis of above points and give them score as per our use case.
Here is the Tabular comparison for each point between Maven and Gradle.
Points | Maven | Gradle | Score |
How easy is the initial learning curve | 1) Maven is XML based tool, XML is very commonly used/known. 2) If existing project are using maven then developers are comfortable with the system. | 1) Gradle is DSL based system and need to learn explicitly. 2) Developers need to learn new system from beginning if they are not familier | Maven - 8/10 Gradle - 5/10 |
How fast are different builds with each tool | Taken a report from zeroturnaround, they have done detail analysis of the speed of builds with both built tools and found maven and gradle are close enough on build timings. | Maven - 8/10 Gradle - 9/10 | |
How complex is it to create and maintain the build script? | Maven build scripts are xml based, which has predefined structure and only one way to write. So it makes it more standard and less flexible. | Gradle has its own DSL which is introduced by Gradle itself and tightly connected to Gradle internals But its flexible and simple and short | Maven - 5/10 Gradle - 7/10 |
How many plugins exist and how simple is it to customize your own plugins? | Maven is called “plugin execution framework” Hundreds of plugins exist for Maven and you can create your own plugin is simple. | Gradle’s architecture is also plugin-based, It’s easy to write plugins But availability of plugin in community may not be ease. | Maven - 8/10 Gradle - 6/10 |
How good is the community and documentation for each tool? | Maven is in the market for very long time, Documentation is good, Lots of resources and help available in open community and forum. | Gradle is very recent. It is open source but still under control of gradleware. They have option for commercial support. | Maven - 9/10 Gradle - 8/10 |
How well does each tool integrate with developer tools? (IDE, App Server, CI server). | With many years of background Maven has full support to almost each tool and every category (IDE, App Server, CI). | Lacking in the App Server and CI Server Categories, mainly due to newness. | Maven - 9/10 Gradle - 5/10 |
(Note - I haven’t given any tool 10/10 because there is always room for improvement).
My scoring is based on following fact.
- One is already using maven for all their project.
Total Score
Maven - 47/60
Gradle - 40/60
One can decide the score on the basis of their user case and requirement.
Choices
- Gradle
You may not be using other features which is used by google for android development as those features may or may not match with your needs however gradle is essentially emerging as popular tool and you may definitely want to have a look at it.
- Maven
Maven is widely used in most of the companies and have robust defined workflow around it. Developers are very much familiar with the system. However this may not be viable option as android development need to use gradle.
- Maven and Gradle (Both)
This would be the one more option for a company with wide range of development area which may give developers flexibility to adopt tool as per their choice with in given workflow.
Comments
Post a Comment