The following is a summary of the major differences between Gradle and Apache Maven:
Flexibility: Google chose Gradle as the official build tool for Android; not because build
scripts are code, but because Gradle is modeled in a way that is extensible in the most
fundamental ways.
Both Gradle and Maven provide convention over configuration. However, Maven provides a
very rigid model that makes customization tedious and sometimes impossible.
While this can make it easier to understand any given Maven build, it also makes it
unsuitable for many automation problems. Gradle, on the other hand, is built with an
empowered and responsible user in mind.
Performance
Both Gradle and Maven employ some form of parallel project building and parallel
dependency resolution. The biggest differences are Gradle's mechanisms for work
avoidance and incrementally. Following features make Gradle much faster than Maven:
Incrementally:Gradle avoids work by tracking input and output of tasks and only
running what is necessary.
Build Cache:Reuses the build outputs of any other Gradle build with the same
inputs.
Gradle Daemon:A long-lived process that keeps build information "hot" in memory.
User Experience
Maven's has a very good support for various IDE's. Gradle's IDE support continues to
improve quickly but is not great as of Maven. 6/71
Although IDEs are important, a large number of users prefer to execute build operations
through a command-line interface. Gradle provides a modern CLI that has discoverability
features like `gradle tasks`, as well as improved logging and command-line completion.
Dependency Management
Both build systems provide built-in capability to resolve dependencies from configurable
repositories. Both are able to cache dependencies locally and download them in parallel.
As a library consumer, Maven allows one to override a dependency, but only by 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.
Maven has few, built-in dependency scopes, which forces awkward module architectures in
common scenarios like using test fixtures or code generation. There is no separation
between unit and integration tests, for example. Gradle allows custom dependency scopes,
which provides better-modeled and faster builds.