aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Why gradle? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Why gradle?" Watch "Why gradle?" New topic
Author

Why gradle?

Marco Antonio
Ranch Hand

Joined: Apr 23, 2008
Posts: 74
Hi everybody and specially to Hubert!

I wonder if you could list the three main advantages Gradle provides and which advantages I would obtain if I migrate my projects from Maven to Gradle. ┬┐Would be it possible in a easy way?


Thank you so much in advance!


Any correction of my English will be gratefully accepted.
Hubert Klein Ikkink
author
Greenhorn

Joined: Jan 10, 2013
Posts: 13

Hi Marco,

For me the three main features/advantages of Gradle are:

* It is a real language/DSL, which means you write your build script like you write your code. You can write methods, use variables, types and refactor to create maintainable build scripts. You don't have to write your build in XML, but use a proper language. Also because Gradle uses Groovy you get the best of the Java world. You can use Java libraries and also use Groovy's elegant language.
* Gradle has industry standard convention-over-configuration features. Gradle supports the industry standard conventions (defined by Maven) for project structures, so you don't have to redesign your project to use Gradle. But also the flexibility to easily extend you build with corner cases you need in your build.
* Support for incremental builds really speeds up the build process. Gradle has very intelligent tasks that can check if they need to be executed or not, based for example on changed source files or property values. We can even apply that to tasks we write ourselves.
* Great support multi-module projects. Gradle allows project dependencies and will figure out what projects need to be build if we have those kind of dependencies. If we work on project B, which depends on project A, then Gradle will determine if project A is up to date and if not will build it, before building project B. Also we can check if projects that depend on project B are still buildable if we make changes in project B with a single command.

To migrate from Maven to Gradle can be easy. Gradle supports the same directory structure, dependencies are fetched from Maven repository (if needed). There is a tool maven2gradle but I haven't used it, so I don't know how it works. Gradle cannot (yet) run Maven build of use Maven plugins. So if you are using a plugin, you probably need to write some extra code. A lot of plugins also have equivalent Ant tasks and those tasks can be used directly in Gradle and then the migration is easy.
Marco Antonio
Ranch Hand

Joined: Apr 23, 2008
Posts: 74
Thanks, Hubert!

That sounds really interesting and very powerful. I'm going to give Gradle a chance and, of course, to your book.


Thank you again!
 
 
subject: Why gradle?