wood burning stoves 2.0*
The moose likes Ant, Maven and Other Build Tools and the fly likes Why should I use Gradle instead of Ant? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Why should I use Gradle instead of Ant?" Watch "Why should I use Gradle instead of Ant?" New topic
Author

Why should I use Gradle instead of Ant?

Rogerio Kioshi
Ranch Hand

Joined: Apr 12, 2005
Posts: 689


SCEA 5 (part 1), SCBCD, SCWCD, SCJP, CLP, CLS
Hubert Klein Ikkink
author
Greenhorn

Joined: Jan 10, 2013
Posts: 13

Hi Rogerio,

Gradle is a build language, a Groovy-based DSL to define your builds. This means you don't have to develop your builds in XML, but you can use a proper language. You can add methods, refactor and create beautiful maintainable build files.
I think a big advantage compared to Ant is the support of plugins in Gradle. A plugin contains build configuration and custom tasks in a single package. You don't have to redefine a Java compiler task for each project, but you can re-use the compiler task from the Java plugin for example. This way it is much easier to re-use tasks across projects.

Ant is great because of the flexibility, we are not bound to a rigid predefined way of working. Gradle gives a choice. We can use the convention-over-configuration feature and really fast create a build for our project, but if the project is different (for example legacy source code directory structure) we can also adjust it easily.

Also Gradle can use existing Ant tasks, custom tasks and build files: http://www.gradle.org/docs/current/userguide/ant.html. The transition is not that hard.
 
 
subject: Why should I use Gradle instead of Ant?