In the continuing series on technologies I don't have a ton of experience on but feel compelled to blog about, Let's talk about Maven. I've had an interesting relationship with Maven over the past few years. I knew lots of smart people use it, I knew there was something I didn't get. So every 6 months I tried to give it a shot and every 6 months it kicked my ass. Every error message Maven would display I would interpret it as, "you're screwed, if you were using Ant at least you'd have a chance in hell of figuring out the problem."
Once again I'm starting some greenfield work and I figured, now is the time to give it another shot. This time I stuck with it. Coming into Maven it really amounts to a few hours of absolute confusion and frustration. After that hump you see the elegance and the power of what it can do for you.
I had reservations about Maven. What happens when you are deploying a critical fix to production and you have to build but Maven is unable to find some obscure transitive dependency that you don't have in version control. Well Maven keeps around a local cache (~/.m2/repository) so if you've built your system already and you haven't introduced a new dependency then you're fine. If for some reason all the Maven dependency magic breaks down you can manually add a jar to your local repository. I had to do it, it's lame, not intuitive but whatever.
Another solution to this is setting up a local repository for your company. That way your version control system isn't full of jars and you can control your repository. The repository just amounts to a directory structure available by HTTP. I just tossed my local cache behind Apache and presto, I have a local Maven repository. So nukes can hit every web server outside of Denver and I can still do a fresh build of my projects on a clean box.
Here are some general points for why I think Maven is better than Ant