Gradle vs Maven vs Ant

Since I've done a lot of stuff with Ant and worked in many projects where maven was the weapon of choice, project sizes have differed massively. As a result I've seen a lot of different configurations, varying from simple standalone applications to complex multi-module projects. Maven looks really suitable for simple projects, or projects where everything should fit into one jar/war file. The problems begin with multi-module Management. Cross-References are not resolved the right way, the build is slow during cyclic references and cache and index reloading causes trouble. If you are using your own repository manager (Nexus, for example), the index and caching problems become much more significant. There are also a few issues with a central settings.xml where version numbers can be stored. Values are not resolved and the behaviour is not reproducible. Scary! The poorly managed primary / third-party repositories are also problematic. They force you to use excludes and old library versions if you don't use a repository manager. The biggest problem with maven, however, is that it forces you to deal with the given project structure and the build life-cycle. There are a lot workarounds you can use (like running ant tasks in maven), but none of them feel right. Features like build automation and automatic deployment are supported but due the complexity of enterprise systems, you'll end up with a bundle of ant tasks in the XML structure of the pom.xml. A few people also complain about XML as being the wrong language to write the build file in, but since I've written a lot of spring-wiring bean files, xml feels wordy, but it's not a problem for me. So I tried to migrate the pom.xml of some of my projects to gradle. It worked fine, aside from the bad IDE support from Eclipse/STS. The resulting build file is about fifteen times smaller and looks pretty readable. WAR bundling and the Jetty task to run the application worked fine. The only problem I discovered: The dependency 'com.sun.xml.ws:jaxws-rt:jar:2.1.4' does not resolve its necessary dependencies. I fixed this issue by downloading the distribution and put them into my "lib" folder. Maybe I'll try to fix it and show my experiments.


Review of Gradle vs Maven

I solved the issues regarding the ‘com.sun.xml.ws:jaxws-rt:jar:2.1.4′ with a google search. I've found threads from people with the same problem, but they used maven. Maven only feels really good if you are building unspecific things like the well known "petshop".

  1. With Gradle you can escape from all the xml junk.
  2. Gradle also supports Apache Ivy.
  3. Tool support from Gradle gets better (eclipse toolset, ...).
  4. Moving from maven to gradle using maven integration, you'll not get rid of the problems maven causes (for example incorrectly defined pom.xml ressources in the maven repository).
  5. Using Gradle results in freedom because it solves major issues such as: The "central repository" way (your problem if you can't find your dependencies or licensing issues apply to a few jar files). You get rid of the "forced convention" and "forced workflow" style (writing your own scripts and plugins in maven is not recommended).
  6. Gradle is a step away from the monolithic way of building software (build results in a system) to a more heterogenous style (build results in a module / service).
  7. Gradle can split the project definition into different files (the include mechanism).
Gradle is also not a "magic bullet"; plugin "hooks" are missing (for example "after project dependecy calculation is completed"). I think maven is also a good system with many advantages. I give the Gradle project good odds to stick around awhile. Buildr is also very good but the target audience of this build system is more focused on alternative jvm languages like scala and jruby. Since buildr uses a ruby syntax many people will stay away from it, but I think it's possible that we will also see buildr as an active project in the next years.