Saturday, 26 January 2008

Pros and Cons of Ant, Maven, Gant

« Java on the Decline? Think Again | Main | The Need for Distributed Version Control in the Enterprise »
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

Then it's chief rival, and the more ambitious alternative...

    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".
Finally, the newcomer with respect for its elders...
    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
Posted by spout at 2:11 AM in stuff about java

 

Pingback: Pros and Cons of Ant, Maven, Gant | Line Of Credit at Sat, 26 Jan 2:59 AM

Pros and Cons of Ant, Maven, Gant
it. There&#8217;s a reason&#8230; that frustrate me about ant. Grails adds usability via the RoR style of simple, standard command line syntax. OK Original post by /dev/spout Share and Enjoy: These

Comment: Stevie 5 at Sat, 26 Jan 6:07 AM

Maven2 support in Netbeans is a dream. Hierarchial projects are handled well if you use the concept of modules properly. We use this a lot, and is probably the # 1 reason right now why our developers are using Netbeans these days instead of Eclipse (oh, the #2 is crappy 64-bit support in Eclipse :))

Comment: edovale at Sat, 26 Jan 12:51 PM

Another maven2 pro:
You get all the power of ant in maven. Ant is like a toolbox to maven.

Pingback: Random Syntax &raquo; Blog Archive &raquo; Pros and Cons of Ant, Maven, Gant at Sat, 26 Jan 4:13 PM

Pros and Cons of Ant, Maven, Gant
looks like the only tool I&#8217;ll need to be exploring for a little while - my new job is quite .NET focussed. Anyway this Blog post does a great job at listing the pro&#8217;s and con&#8217;s of Ant, Maven and Gant. Gant is a Groovy powered build system which

Comment: MYOB at Sat, 26 Jan 7:46 PM

I can't believe that the brittleness, lack of usability and atrocious documentation of Maven did not make the cons list for that pile of crap.

Comment: hohonuuli at Sat, 26 Jan 7:53 PM

I attended a talk once by a maven project guy. His demo didn't work.

That's a pretty poor sampling on your part. I'll help double your sample size...I built a project with maven and it worked! ;-)

Actually I use maven for most of my projects these days. Hell, some developers where I work are using make to build Java projects. (They write their java code in emacs too...)

Comment: IvanoBulo at Sun, 27 Jan 2:23 AM

Yet another maven 2 pro (comparing with Ant):
You can add new developers to the project without having to train them how to build and run the project.
Commands lke "mvn install" and "mvn jetty:run" are easy to remember even for a monkey :)

Comment: Steen Lehmann at Sun, 27 Jan 4:27 AM

So check out Buildr, the build system that doesn't suck. It's a Ruby-based build system for Java projects, recently incubated into Apache. Uses Maven2 repositories and other Maven bits and pieces (the parts that don't suck, presumably).

http://incubator.apache.org/buildr/

Comment: bwtaylor at Sun, 27 Jan 8:21 PM

Steen - are there any major projects using buildr? I'd certainly consider it, though I have to say it's reliance on Ruby (presumably jruby?) for scripting instead of groovy (or beanshell) seems to me to be a serious barrier to widespread adoption.

IvanoBulo - I think low rampup time overlaps a lot with "standarized build process". Also, is there an easy way to ask maven to tell you what "mvn xxx:yyy" commands a project supports and what they do. Although targets aren't standardized, "ant -projecthelp" or "ant -p" for short are pretty helpful and I personally don't experience the pain of everybody doing the build differently in ant until I'm want to change it or otherwise reading the build.

hohonuuli - using emacs is fine, but the only excuse for using make is unwillingness to learn something new. Shame on their manager for allowing them to do that.

MYOB - umm, the 5th con IS "brittle". And "lack of usability" is a good summary of several of the other cons. It's too vague of a statement for me, so I stated the ways I find it to be hard to use. Gant's docs are much worse, btw.

edovale - I suppose I should have acknowledged that maven2 can be extended with ant tasks. I see this as a workaround for spotty support for maven as opposed to something that enhances ant the way gant does.

Stevie 5 - Glad to hear netbeans works well with maven. I also hear IDEA does too. I might change my IDE to adopt maven, but I wouldn't be comfortable asking a team to preclude Eclipse just to switch. This isn't maven's fault, it's Eclipse's, but it's true none the less.

Comment: John P at Sun, 27 Jan 10:45 PM

Ant also allows embedding of script languages (such as Groovy and Ruby) which can get you some of the gains of Gant.

Comment: Mike at Mon, 28 Jan 8:14 AM

>> Hierarchical projects clash with Eclipse

I dont understand why everyone blames maven for eclipse's shortcomings.

Comment: jbisotti at Mon, 28 Jan 8:51 AM

Ivy can be used with Ant to get Dependency Management.

Comment: bwtaylor at Mon, 28 Jan 1:42 PM

Mike - I don't blame Maven, I blame Eclipse. But life isn't fair, so it is a "Con" against Maven.

jbisotti - I should've mentioned Ivy, you are right.

« January »
SunMonTueWedThuFriSat
  12345
6789101112
13141516171819
20212223242526
2728293031