Maven Love and Hate
Maven Love and Hate
Join the DZone community and get the full member experience.Join For Free
Delivering modern software? Atomist automates your software delivery experience.
You get away from the large, complex build.xml scenario when you move from Ant to Maven, but depending on the software you're writing, you don't save on verbosity! Right?
I'm a big fan of Maven, and I'm excited about Maven 3. To be fair I've not been using it long - less than 6 months professionally - but in comparison to Ant it seems to be a no brainer.
Like most Ant fanatics I was staunchly opposed to Maven's despotic structure and have to admit that only through ignorance did I not try it sooner. The learning curve put me off too; my assumption was that the words "mvn" and "archetype" were far too alien and I was never going to learn. Thankfully I took the plunge and spent five minutes learning the basics and trying it out for myself.
What I love
Its design. The goal structure is simple yet powerful; it yields so much with such little effort. A quick "mvn install" and I have my web project WAR'd, my library JAR'd, my code compiled, versioned, packaged and ready to ship. Beautiful.
Its reliable and sturdy implementation. It never fails. If something's broken, it's either my fault or a bug in a plugin; Maven's always right.
Its object/hierarchical nature: I can be consistent and organised with very little effort.
Getting up and running with compilation, packaging and versioning in seconds by just typing "mvn archetype:generate".
Most of all, having unit testing out of the box, ready to go means I think of it sooner than I forget it which encourages me to write tests because I have little to do - there's a class already setup for me, and it'll be run every time I compile, so no laziness because "it's a tiny change, nothing will break".
What I don't love
I don't love the verbosity. Well that's not entirely true - verbosity can be a good thing when applied correctly - but with Maven I see level after level of elements describing the plugins that I need configured, the arguments passed to xjc and the like. It just gets quite heavy, and it does so quickly. In the Ant world, using a task was relatively painless; yes it meant your build process got complex and bloated in a matter of minutes, but some things were less...wordy. I wonder, how would an Ant build process perform if it took Maven's concepts and design and implemented it? A colleague did point out the other day though: you're building large & complex software, the build process is bound to be large too.
You know what I really hate? I hate having to configure the maven compiler plugin every time I start a new project. Seriously, cut it out! It's not big, and it's not clever. Yes, I could have a Super POM of my own that defines this, but when I'm hacking together something throwaway I still don't want to have to add a parent section no matter how easy and simple it is.
Another thing: where's the default maven Super POM exactly? :)
Are you convinced?
What are your experiences? Am I just being a typical newbie? How do you structure your projects? Do you see any other pitfalls or issues with Maven?
Disclaimer: I'm not writing Ant off. Apache Ant is a fantastic tool and has its place, I just enjoy Maven more right now.
Opinions expressed by DZone contributors are their own.