Finally... Maven

DZone 's Guide to

Finally... Maven

· Java Zone ·
Free Resource
I've always been a happy Ant user. Even more so since Ivy has been available. Obviously that puts me in one side of the fence and I've been a very proactive supporter of that kind of project configuration. I must admit that included some rants about Maven here and there. In my biased opinion Maven lacked the flexibility that Ant provided and it was all about dependency management which was handled fine by Ivy. Probably my lack of confidence (knowledge) with the tool had some influence there too.

Four things made me reconsider my position: Hudson, Sonar, Netbeans 6.7 and the amount of time I was spending writing scripts. At work I had to install a CI server a couple of weeks ago and I was not using CruiseControl if at all possible (bad bad memories, I guess). That left Hudson as the best option (well, for me). I spent some time through the documentation and quickly realized that Maven was quite more straightforward than Ant this time. I needed a quality tool as well and Sonar has always been on my radar. Sonar works (again) out-of-the-box with Maven and requires some extra configuration with Ant. Being the lazy developer that I am I decided to test Maven with one project and see the results.

My first impression was pretty favorable. Migrating a simple Java project was a breeze and setting the job in Hudson trivial. I had the statistics online in less than half an hour. Finally I was understanding what was so good with Maven. It was not transitive dependency management, it was Convention over Configuration with the added benefit that other people where writing very interesting plugins for me. With absolutely no work on my side I had an automated build, quality control (testing plus quality assurance) and Jetty running. By now, I was in love with Maven. In more detail:

  • Zero configuration
    So much time lost with Ant refurbishing the same scripts time and again...

  • Dependency management
    I found Maven quite easier to handle than Ivy. I really really missed the master configuration of Ivy though (it saves time when you don't want transitivity for any reason).

  • IDE support
    Today all major IDEs include seamless integration with Maven2. Latest Netbeans release, in particular, works wonders (the reactor plugin is awesome). Ivy support is scarce by contrast.

  • Redistribution
    I've had to invest quite some work, many times, to offer Ant+Ivy scripts along with different project files (Eclipse, Netbeans, IDEA) to appease all kind of users. Not any longer. POMs are treated as first class citizens everywhere now. With the added benefit that I'll be able to upload the builds to the central repository.

  • Future
    I'm under the impression that things like OSGi will be pretty much simpler with this approach.

All in all, I'm leaving Ant. For good. I can't say anything but praises about Ant, it's been years of comradery. And yes, it's a somewhat sad situation but I can't help seeing it obsolete, overridden..

From http://internna.blogspot.com/


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}