Saturday, 26 January 2008
Pros and Cons of Ant, Maven, Gant
I've been thinking about java build tools again. My projects have always ended up using ant and wondering about Maven. There's certainly some innovative ideas in Maven, but there's also some things that scare me. It's funny that Maven's reliance on "convention over configuration" easily predates the Ruby on Rails fad, but the latter gets all the credit for inventing it. There's a reason for that. Anyway, the new kid on the block is Gant, and the way that it's being used in Grails seems really interesting. Gant is a marriage of groovy with ant, which addresses some of the things that frustrate me about ant. Grails adds usability via the RoR style of simple, standard command line syntax. OK, so here's my pros and cons of Ant, Maven2, and Gant.
First I take a look at the old workhorse...
- Ant
- Pros
- Everybody knows it
- Everybody supports it. Ant tasks exist for everything.
- Extensible. Writing macros and tasks yourself is easy.
- Flexible, properties configuration
- Well documented, even by 3rd party tools
- Low tech and hackable: no hidden magic or voodoo.
- Path structures and wildcards are simple, yet powerful
- Cons
- Everybody know it, including people who shouldn't touch a build. Ever.
- No standards - few conventions and idioms. Everybody does it different.
- Everybody does it different, even from their previous project.
- XML does not facilitate reuse.
- Limited expressiveness. I have to use ant-contrib to say "if"!?!?! or for <ac:propertycopy name="username" from="db.${db.server}.username">
- XML Sprawl. As XML goes, not that verbose, but nothing is by convention
- Maven 2
- Pros
- Standardized build lifecycle
- Drop-in reuse of build tools
- Dependency management
- Internal repositories facilitate enterprise code sharing
- Archetype concept allows speed starting project by flavor
- Cons
- Hierarchical projects clash with Eclipse (Bug 35973 is 3rd overall with 144 votes today.)
- Extending isn't simple. mojo, schmojo.
- Many mundane tasks are truly cumbersome.
- Archetypes are a great idea ruined by horrible syntax. This is why grails doesn't use Maven.
- Brittle builds. Some say broken by design. I attended a talk once by a maven project guy. His demo didn't work.
- Repository metadata quality. This is Matt Raible's #1 Complaint. Maintaining transitive dependencies is hard and brittle.
- Verbose XML syntax in POMs
- Plugin avialability lags behind Ant
- Endless downloading of jars. Go to lunch while maven "downloads the internet".
- Gant, Groovy, and/or Grails
- Pros
- Ultra-expressiveness of groovy. No more wrestling to do mundane things
- No more programming in XML.
- Smooth adoption path: first use ant's groovy task, then AntBuilder in groovy, then Gant, then wrap in a grail-like runner and scaffolding
- Grails scaffolding is simple, powerful, and immediately useful.
- Leverage the ubiquity of 3rd party ant tasks. Steal the best part of Rails but backed by ant's mountain of 3rd party tasks
- Build logic expressed in groovy classes should facilitate reuse
- Cons
- Very young technology
- Groovy is just starting to penetrate the masses. Gant still largely unknown.
- Ok, I admit the only grails-like runner is Grails for now
- Documentation is poor. Really poor.
- Tooling is weak. IDE's don't support Gant or Grails style lauchers
- No standard build lifecycle if you use ant+groovy or gant without grails
Technorati Tags: java build ant maven gant grails
Posted by at 2:11 AM in stuff about java
