Maven: great idea, poor implementation (Part 1)
I've been building Java software using Ant for over 10 years. I've been giving Maven a try every few years since it first came out, and going back to Ant pretty quickly each time, until last year. Early last year I used Maven on a few smallish - pretty much one-person - projects, and found it to be pretty useful, so I decided it may be ready for prime time.
Recently I've begun working on my first build system for a ThoughtWorks project, which happens to be using Maven, and although I've been enthusiastic about the challenge, the weaknesses of the tool are showing pretty clearly.
The idea of Maven is a good one - it's a standardised build system that, off the shelf, does pretty much what you need for typical Java projects, using convention over configuration. Ant, on the other hand, is not a build system, it's a tool that you can use to create your own build system. It's almost a DSL for build systems, but far more flexible.

The thing is, at least 95% of Java projects have pretty much the same set of requirements from a build system. Get my dependencies. Compile my source. Run my unit tests. Run some analysis. Package my artefact. Run integration tests. Deploy. Build multiple modules into a single aggregated artefact. That's pretty much it.
So everyone who uses Ant is using it to do pretty much the same thing, but they create wildly different build systems to do it. As a result, new team members have a serious learning curve, and often require days or even weeks to get set up. Adding tools such as a new code analysis report is not a simple drop-in, and the build system's complexity tends to grow over time.
A typical project's Ant-based build system is as complex, and as time consuming to maintain, as any major component of the software it builds. It accumulates technical debt and adds drag on the project's velocity.
So rather than every team having it's own home-brewed special
snowflake build system, Maven aims to be a build system that uses
convention over configuration to build any Java project that follows a
common pattern. It's become popular enough that other tools can just be
dropped in, and a developer joining a Maven-based project could be up
and running in less than a day, in ideal cases in under an hour.
Ideally, by using Maven on our project we eliminate the hassle of maintaining a complex build system, because Maven simply does what we need, by default.
This is a worthy goal. Unfortunately, Maven falls short. I'll share why I think this is in part 2 and part 3 of this series.
Source: http://kief.com/maven-great-idea-part-1.html
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)






Comments
Thai Dang Vu replied on Mon, 2012/01/09 - 10:04am
I wonder if your project structure is as "weird" as the one I'm working on at my company which uses Ant by the way. This is how it is structured:
The idea sounds nice, doesn't it? because we seem to have independent directories. Actually, there's rarely a case where they all are independent. There's usually a dependency between them or there's another directory that glues all the other directories together.
Do you think it will be better to switch to Maven or keep using Ant with huge, complicated build.xml files?
Mark Davidson replied on Mon, 2012/01/09 - 10:19am
in response to:
Thai Dang Vu
Tomek Kaczanowski replied on Mon, 2012/01/09 - 5:06pm
Christopher Wong replied on Tue, 2012/01/10 - 8:42am
I have my own issues with Maven, particularly its own implementation of convention over configuration (CoC). CoC is a pain when not done right. Maven is verbose without being obvious, which means it lacks the advantages of CoC while bringing in the disadvantages.
The trouble with being conventional
David Jones replied on Wed, 2012/01/18 - 8:52pm
Darryl Parks replied on Mon, 2012/03/05 - 10:23am
in response to:
David Jones
I agree with David, Maven is a great tool and solved lots of issues in builds. I don't see Maven as a panacea and you may still need ANT or another build script for other things, but I think Maven rocks. What it does, it does well. Just check out Indeed.com, Maven is taking over. From what I've seen Gradle doesn't solve any real issues and misses some of the advantages Maven provides.
But if you're idea of cool is coding scripts in of all things XML, feel free & stagnate. The rest of the world is moving on.
Sfafaef Adfasg replied on Fri, 2012/06/01 - 10:20am