Thursday, May 7, 2009

Initial Maven v Ant observations

Let me start off by saying that I am by no means an expert in Maven, so these are my initial thoughts. Also, this is on Maven 1.x - we have some plugins that we are using that we can't use on 2.x.

So far I prefer Ant over Maven. With Maven, many things are "hidden" for you. In order to figure out what is going on you have to rely on documentation, which isn't always the best. With Ant, yes, you need to explicitly build up your targets with filesets, etc, but at least by glancing at the build targets you can tell what is going on. With Maven, it is like magic that things work - you don't necessarily know why; the reverse is also true - when things fails you also don't know why. With that said though, I have come across highly structured, templated Ant build scripts/frameworks where you have the same issue of not knowing what to call or why something fails, since many of the details have been abstracted into some main build.xml.

One argument for Maven over Ant is that if you add new projects, files, jars and if you follow the Maven conventions you don't have to update your build files. Yes that may be true, but is all of the black-magic really worth it. It doesn't really take much time at all to update your Ant files and again, you are explicitly in control and can see what is going on. The other Maven argument is dependency management. To me, unless what you are building is absolutely huge, this is entirely manageable in Ant. Worst case is that your CI build breaks because some dependency wasn't updated in your build.xml and someone has to take a few minutes to fix it. In both cases, ongoing build maintanence is required anyway - there is no build solution out there that doesn't require refactoring over time.

I guess what it all comes down to (with frameworks in general) is that there is no silver bullet. You just end up with a different set of problems. At least with Ant it is more obvious what is going on.

1 comment:

  1. We've been using Maven 2.1 over here, and it seems to work pretty well. The M2Eclipse plugin for Eclipse lets maven handle project dependencies seamlessly in Eclipse, and has a pretty good pom editor as well.

    ReplyDelete