Gradle, Madrid GUG meeting, April 2012

In the monthly meeting that we had this month in GUG we were lucky to have Mario García (@marioggar) showing us Gradle and confronting it to Maven.

We started with a brief historical review of the build tools.

We started in year 2000, when Apache Ant was released. It was a tool, where ir prevailed the configuration over the convention, based on xml and, in general, too verbose but really flexible too without dependency handler.

Next we arrived to Maven. Completely opposite to Apache Ant, a model based on convention over configuration, also based in xml but less verbose and with dependency handler, but less flexible.

And we finally arrived to Gradle. A tool to build software combining the Ant flexibility with the Maven conventions. With it, we can use Groovy thorugh a DSL and create tasks without abandon the conventions. Grooby allows us to reduce the number of code lines and also, as it is code, you can do things like tracing, testing, etc.

After introducing the opponents, we started with the ‘fight’:

Round 1: Xml vs code

While Maven is based in XML and you always have to write certain labels to perform some tasks, Gradle allows us you to do the same but with code.

Round 2: Convention over configuration.

Despite both start off conventions, Gradle allows you to extend the convention with Ant, Groovy, types, task dependency order (not depending on the Maven lifecycle).

Round 3: Lifecycle

Maven lifecycle has a los of stages: validate, compile, test, package, integration-test, verify, install, deploy… but Gradle lyfecicle has only 3 stages: initialisation, configuration y execution.

Round 4: Scripting

To do scripting with Maven is a hell and if you want to use it, you will end embedding code in the XML. Nevertheless, in Gradle, the script is code itself so you can import plugins or classes already created.

Round 5: Dependencies

Maven is a reference for management and distribution of dependencies and that’s why Gradle delegates to Maven/ivy to handle them. But you should be aware that the nomenclature of the scopes changes.

Round 6: IDE support

Maven has been adding support for environments like Netbeans, Eclipse and IntelliJ, but Gradle, despite of its short life, already has support for Netbeans (limited), Eclipse (STS) and also for IntelliJ.

Round 7: Multiproyect

While Maven declares a parent pom.xml with its children and it inherits the configuration and the properties, Gradle separates the child configuration from the inheritance configuration.

With the result of this ‘confrontation’, I agree with Mario’s conclusions. Gradle has a lot of advantages and I think that it can be a really powerful and helpful tool. So I hope to have more time to dive deeper into it and I thanks Mario for preparing this nice introduction.

@albertovilches recorded the talk and you can see it here (spanish):

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone

Leave a Reply

Your email address will not be published. Required fields are marked *