99
votes

There is a lot of talk on the internet about how Maven is bad. I have been using some features of Maven for a few years now and the most important benefit in my view is the dependency management.

Maven documentation is less than adequate, but generally when I need to accomplish something I figure it out once and then it works (for example when I implemented signing the jars). I don't think that Maven is great, but it does solve some problems that without it would be a genuine pain.

So, why does Maven have such a bad rep and what problems with Maven can I expect in the future? Maybe there are much better alternatives that I don't know about? (For example, I never looked at Ivy in detail.)

NOTE: This is not an attempt to cause an argument. It is an attempt to clear the FUD.

12
  • 29
    I've never heard anyone speak badly of Maven. I've found projects to be much more productive with Maven than Ant. Commented May 14, 2009 at 3:17
  • 2
    I agree with Taylor. I haven't used Maven, but I've heard many people speak highly of it. This question looks a lot like FUD. Commented May 14, 2009 at 3:19
  • 27
    @Taylor, @Matthew, @victor: I'm surprised you haven't seen some of the Maven rants. It's a very divisive tool. It's a real love-it-or-hate-it thing. Some people love the dependency-management cleverness and accuse those that don't like it of not getting it, and some people only see the problems that can and do occur with complex distributed dependencies and decide its not worth the hassle.
    – Dan Dyer
    Commented Jan 9, 2010 at 21:40
  • 8
    Maven does not respect the KISS principle. Try to do anything besides mvn clean install and you are in trouble. With ant you can do whatever you want without any pain. Commented Aug 10, 2010 at 2:56
  • 4
    It's only one anecdote, but moving from Maven to Ant caused our incremental build times to go from ~15s to well over 2 minutes. You won't find a lot of Maven fans on our team. Commented Dec 5, 2011 at 14:51

48 Answers 48

141
votes

I looked into maven about six months ago. We were starting a new project, and didn't have any legacy to support. That said:

  • Maven is all-or-nothing. Or at least as far as I could tell from the documentation. You can't easily use maven as a drop-in replacement for ant, and gradually adopt more advanced features.
  • According to the documentation, Maven is transcendental happiness that makes all your wildest dreams come true. You just have to meditate on the manual for 10 years before you become enlightened.
  • Maven makes your build process dependent on your network connection.
  • Maven has useless error messages. Compare ant's "Target x does not exist in the project y" to mvn's "Invalid task 'run': you must specify a valid lifecycle phase, or a goal in the format plugin:goal or pluginGroupId:pluginArtifactId:pluginVersion:goal" Helpfully, it suggests I run mvn with -e for more information, which means that it will print the same message, then a stack trace for a BuildFailureException.

A large part of my dislike for maven can be explained by the following excerpt from Better Builds with Maven:

When someone wants to know what Maven is, they will usually ask “What exactly is Maven?”, and they expect a short, sound-bite answer. “Well it is a build tool or a scripting framework” Maven is more than three boring, uninspiring words. It is a combination of ideas, standards, and software, and it is impossible to distill the definition of Maven to simply digested sound-bites. Revolutionary ideas are often difficult to convey with words.

My suggestion: if you can't convey the ideas with words, you should not attempt to write a book on the subject, because I'm not going to telepathically absorb the ideas.

18
  • 134
    To those who understand Maven, no explanation is necessary. To those who don't, no explanation is possible.
    – Apocalisp
    Commented May 14, 2009 at 13:06
  • 35
    One of your bullet points is false. -o - offline mode, so no, it does not make your build process dependent on your network connection. Commented May 14, 2009 at 14:27
  • 10
    I agree on the all-or-nothing point. I've seen to many people waste too much time trying to keep half of their project portfolio in ant and half in maven. Once you commit, you have to put the work in to convert every part of your deployment.
    – sal
    Commented May 14, 2009 at 17:25
  • 14
    @Apocalisp: So, in other words, the only people who understand Maven are the people who wrote it?
    – Powerlord
    Commented May 14, 2009 at 18:10
  • 5
    Maven is all-or-nothing. This isn't true. You can use maven for dependency management and nothing else if you want. All it takes is one working example of how to use the Maven ant tasks to read your pom file and generate an ANT classpath containing all your dependencies.
    – Jherico
    Commented Nov 13, 2009 at 22:02
109
votes
  • It imposes rigid structure on you from the start.
  • It's XML-based so it's as hard to read as ANT was.
  • Its error reporting is obscure and leaves you stranded when things go wrong.
  • The documentation is poor.
  • It makes hard things easy, and simple things hard.
  • It takes too much time to maintain a Maven build environment, which defeats the point of having an all-singing build system.
  • It takes a long time to figure out that you've found a bug in maven and not configured something wrong. And the bugs do exist, and in surprising places.
  • It promises much but betrays you like a beautiful and seductive but emotionally cold and manipulative lover.
6
  • 45
    ++ It makes hard things easy, and simple things hard. It's so right!
    – Martin K.
    Commented Aug 12, 2009 at 12:34
  • 8
    "It promises much but betrays you like a beautiful and seductive but emotionally cold and manipulative lover." hahahaha... that sounds alot like that master fong from "Balls of Fury"
    – cesar
    Commented Aug 26, 2009 at 7:23
  • 8
    Re bullet point 2: It uses elements almost always, attributes almost never, so the XML is even harder to read than Ant's! Commented Jan 22, 2010 at 19:15
  • 4
    +1 for the last bullet. Nothing makes my day like coming across an awesome and hilarious analogy that is so true.
    – Adam
    Commented Jun 23, 2010 at 17:25
  • 1
    The documentation is not poor, it is excellent.
    – Dave
    Commented Jul 14, 2010 at 17:32
96
votes

I've certainly bitched & moaned about maven in the past. But now, I wouldn't be without it. I feel that the benefits far outweigh any problems. Chiefly:

  • Standardized project structure.
    • Given a new developer joining a project:
      • When you say it's a Maven project, then developer knows the project layout and how to build and package the project
      • When you say it's an Ant project, then developer will have to wait for you to explain more or will have to go through the build.xml to figure things out.
    • Of course, it's always possible to impose on company-wide standard with Ant but I think more often than not, you will be re-inventing the proverbial wheel.
  • Dependency management.
    • Not just with external libraries but also with internal libraries/modules. Be sure to use a Maven repository proxy server such as Nexus or Artifactory.
    • It's possible to do some of this with Ivy. In fact, if all you need is a dependency management, you're probably better off using Ivy.
  • Particularly within a project. I've found it quite useful to break out little subprojects, and maven handles this well. It's much more difficult with ant.
  • Standardized artifact management (especially in conjunction with nexus or artifactory)
  • The release-plugin is wonderful.
  • The Eclipse & NetBeans integration is quite good.
  • Integration with hudson is superb. Particularly the trend graphs for things like findbugs.
  • It's a minor point, but the fact that maven embeds details like the version number inside the jar or war (not just in the filename) by default is tremendously helpful.

The downsides for me are chiefly:

  • The command line is quite unhelpful. This put me off a lot to begin with.
  • The XML format is very verbose. I can see why it was done that way, but it's still a pain to read.
    • That said, it's got an XSD for easy editing in an IDE.
  • It's difficult to get your head round it in the beginning. Things like the lifecycle, for example.

I truly believe that it's worth spending a little bit of time getting to know maven.

3
  • 2
    I don't particularly mind the XML format (Eclipse can look after most of the tedious parts) and build instructions for large projects are typically nasty and complex anyway. For example, you've not truly bashed your head out on a brick wall until you've tried to get GNU automake to do something it doesn't care for… Commented Aug 14, 2010 at 16:06
  • 2
    IntelliJ also has excellent Maven support. Commented Dec 8, 2010 at 2:38
  • 1
    Oh look a sensible response with details. Commented Apr 14, 2012 at 11:14
80
votes

My practical experience from two large projects is that we have spent 1000 - 1500 hours for each project on maven related problems, excluding a 500 hour effort of moving from maven 1 to maven 2.

Since then, I must say that I absolutely hate maven. I am getting frustrated when thinking about it.

The Eclipse integration is awful. (We had endless troubles with code generation for instance, where eclipse got out sync with the generated code, and required a complete rebuild, quite often. The blame is both maven and eclipse, but eclipse is more useful than maven and say emacs, so eclipse stays and maven have to go.)

We had a lot of dependencies, and as we discovered, syntax errors are actually commited to public maven repositories quite often, wich can ruin hours of your valuable time. Each week. The workaround is to have a proxy or locally governed repository and that took quite some time to get right, too.

Mavens project structure is not really suitable for development with Eclipse, and the build time in eclipse increases.

An effect of the code generation and sync problem, we had to rebuild from scrach rather often, reducing your code/compile/test cycle to an endless compile/websurf/sleep/die/code-cycle, sending you right back to the 90s and 40 minute compile times.

The only excuse for maven is the dependency resolution, but i would like to do that once in a while, not in every build.

To sum up, maven is as far from KISS as it can be. And also, advocaters tend to be the type of people that celebrates extra on their birthday when their age is a prime-numer . Feel free to vote me down :-)

15
  • 3
    I agree with some of what you say actually, though I think I finally got it right. To get what you want however you can have a look at Ivy, did not try it yet but it seems to bring dependency management in a more structured Ant environment.
    – Newtopian
    Commented Aug 12, 2009 at 12:48
  • 5
    So, did you find any good alternative to Maven?
    – Thilo
    Commented Oct 27, 2009 at 6:09
  • 4
    The Eclipse integration is still awful. In spite of having up-to-date plugins, there are plugin-controlled maven tasks that fail with obscure error messages. Colleagues then tell me to drop to a command shell and run the same command... then it mysteriously works. Eclipse is a mature environment, the maven plugin lags far behind. Commented Aug 10, 2010 at 13:16
  • 2
    There is a fundamental difference how Maven and Eclipse defines what a project is. In Maven, a project is more or less a convenient way of organizing the source code. Eclipse was initially designed so that you were able to work on one or a few more or less unrelated projects at the same time. Later (not always sound) requirements lead to IBMs abuse of projects as "modules" which eclipse actually handles rather bad. In order to converge the definitions, in a lot of cases, maven projects should probably be mapped to eclipse source folders. However, as maven is teh suck, why bother.
    – KarlP
    Commented Aug 11, 2010 at 7:48
  • 3
    Hey! I bemoan the fact that the next time I will be a prime age is 29, and the next perfect cube age is 64, and my last perfect penteract age will be 32... but I don't actively advocate maven. Commented Aug 20, 2010 at 11:04
46
votes

Maven is great. The reason for its reputation has got to do with the steep learning curve, in my opinion. (which I am finally close to getting over)

The documentation is a bit rough to wade through, simply because it feels like there's a lot of text and new things to comprehend before it starts making sense. I say time is all that's needed for Maven to become more widely praised.

7
  • 6
    This may be somewhat true, but I've found that using Maven integration with Eclipse really helps trim the learning curve for folks. m2eclipse.codehaus.org Commented May 14, 2009 at 3:26
  • 2
    @Taylor, I had a lot of problems with the plug-in, especially if you use some other version of Eclipse or heaven forbid RAD. I think it is getting there, however...
    – Dan
    Commented May 14, 2009 at 3:31
  • I've only used it with Eclipse 3.3, 3.4, and JBoss developer studio and agreed there are some minor annoyances (like the POM editor not playing nice) but I haven't had any major issues. Commented May 14, 2009 at 3:34
  • 10
    Its not the learning curve that bothers me. It's really not that hard to understand. My problem is that for large (commercial) projects, you get much less value than the effort spent. OK, your projects builds. Cool, but the cost of a man year spent, constant build failures due to external factors, 10 minute compiles instead of 5 seconds and an ugly eclipse workspace , it's just not worth it. Besides, for the same cost, you can more or less hire a guy that is constantly is building the trunk manually.
    – KarlP
    Commented May 15, 2009 at 20:18
  • 8
    @Karlp - well, you don't understand it fully yet... 1.) "failures due to external factors" - you should create a project repository that you keep all your dependencies in, and that you control the versions of. 2.) "10 minute compiles instead of 5 seconds" - maybe for the initial maven install and first build - maven downloads all dependencies it needs plus your project - but regular builds you're doing to attempt to build your own code shouldn't be downloading - see 1 - also, offline mode. 3.) "ugly eclipse workspace" - maven works in all major IDEs (NB, IntelliJ) and from the command line.
    – Nate
    Commented Aug 12, 2009 at 10:27
24
votes

Because Maven is a device for reducing grown men to sobbing masses of absolute terror.

2
  • 3
    We should mass-produce it and sell it to all the villains for a huge profit! Commented May 14, 2009 at 8:13
  • 7
    No! Maven cannot be used for profit. It can only be used for evil.
    – Apocalisp
    Commented Jan 22, 2010 at 23:47
18
votes

Pros:

  • Dependency management. For several years already, my coworkers and I are not downloading and managing dependencies manually. This is a huge time saver.
  • IDE-independence. It turns out, all major IDEs, Eclipse, IDEA and NetBeans how have decent support of Maven projects so our developers are not locked into one particular IDE.
  • Command-line. With Maven, supporting simultaneous IDE and command-line configurations is straightforward which is good for continuous integration.

Cons:

Competition:

  • Ant: doesn't have dependency management. Period.
  • Ivy: still less mature than Maven (not that the latter doesn't have it's quirks, too). Almost the same feature set, so no compelling reason to move. I did several attempts to try it; all unsuccessful.

Bottom line: all of our projects are done with Maven for several years already.

1
  • 3
    Ant doesn't compete with Maven. Ivy doesn't compete with Maven (it competes with Maven Ant tasks). Maven is more than a build tool + dependency management. Period. Commented Mar 16, 2010 at 23:06
18
votes

I think it has a bad reputation with people who have the most simple and the most complicated projects.

If you're building a single WAR from a single codebase it forces you to move your project structure around and manually list the two of three jars into the POM file.

If you're building one EAR from a set of nine EAR file prototypes with some combination of five WAR files, three EJBs and 17 other tools, dependency jars and configurations that require tweaking MANIFEST.MF and XML files in existing resources during final build; then Maven is likely too restricting. Such a project becomes a mess of complicated nested profiles, properties files and misuse of the Maven build goals and Classifier designation.

So if you're in the bottom 10% of the complexity curve, its overkill. At the top 10% of that curve, you're in a straitjacket.

Maven's growth is because it works well for the middle 80%

16
votes

My experience echos the frustration of many of the posts here. The problem with Maven is that it wraps and hides the details of build management in its quest for ultimate automagical goodness. This makes you nearly helpless if it breaks.

My experience is that any problem with maven quickly degenerated into a multi-hour snipe hunt through webs of nested xml files, in an experience similar to root canal.

I've also worked in shops that relied heavily on Maven, the people who liked it (who liked it for the "push a button, get it all done" aspect) didn't understand it. The maven builds had a million automatic targets, which I'm sure would be useful if I felt like taking the hours to read through what they did. Better 2 targets that work that you fully understand.

caveat : last worked with Maven 2 years ago, it may be better now.

14
votes

Like Glenn, I don't think Maven has a bad rep, but a mixed rep. I have been working for 6 month exclusively trying to migrate a rather big project project to Maven and it clearly shows the limits of the tool.

In my experience, Maven is good for:

  • external dependency management
  • centralized management of the build (pom inheritance)
  • lots of plugins for lots of things
  • very good integration with continuous integration tools
  • very good reporting capabilities (FindBugs, PMD, Checkstyle, Javadoc, ...)

And it has some problems with:

  • all or nothing approach (hard to migrate slowly to Maven)
  • complexe dependencies, intermodules dependencies
  • cyclic dependencies (I know, bad design, but we can't fix 5 years of dev ...)
  • coherence (version ranges don't work the same everywhere)
  • bugs (again with version ranges)
  • reproducible builds (unless you fix the versions number of all the plugins, you can't be sure you will get the same build in 6 months)
  • lack of documentation (the doc is quite good for the basics, but there aren't a lot of examples of how to handle large projects)

To give some context, there are around 30 developers working on this project, and the project has been around for more than 5 years, so: lot of legacy, lots of process already in place, lots of custom proprietary tools already in place. We decided to try migrating to Maven because the cost of maintaining our proprietary tools was getting too high.

12
votes

I'd like to counter a few of the complaints made in this forum:

Maven is all-or-nothing. Or at least as far as I could tell from the documentation. You can't easily use maven as a drop-in replacement for ant, and gradually adopt more advanced features.

This isn't true. Maven's big win is using it to manage your dependencies in a rational way and if you want to do that in maven and do everything else in ant, you can. Here's how:

<?xml version="1.0" encoding="UTF-8"?>
<project name="foo" basedir="." xmlns:maven="antlib:org.apache.maven.artifact.ant" >
  <maven:dependencies verbose="true" pathId="maven.classpath">
    <maven:pom id="maven.pom" file="pom.xml" />
  </maven:dependencies>
</project>

You now have a classpath object named 'maven.classpath' which contains all the maven dependencies defined in the pom file. All you need is to put the maven ant tasks jar in your ant's lib directory.

Maven makes your build process dependent on your network connection.

The default dependency and plugin fetching process depends on a network connection, yes, but only for the initial build (or if you change the dependencies or plugins in use). After that all the jars are locally cached. And if you want to force no-network connection, you can tell maven to use offline mode.

It imposes rigid structure on you from the start.

Its not clear if this is referring to the file format or the 'convention versus configuration' issue. For the latter, there are a lot of invisible defaults like the expected location of java source files and resources, or the compatibility of the source. But this isn't rigidity, its putting in sensible defaults for you so you don't have to define them explicitly. All the settings can be overridden pretty easily (though for a beginner it can be hard to find in the documentation how to change certain things).

If you're talking about the file format, well that's covered in the response to the next part...

It's XML-based so it's as hard to read as ANT was.

First off, I don't see how you can complain that some aspect of something 'Isn't better than ant' as a justification for it having a bad rep. Second, while it still XML, the format of the XML is much more defined. Further, because its so defined, its a lot easier to make a sensible thick client editor for a POM. I've seen pages long ant build scripts that jump all over the place. Any ant build script editor isn't going to make that any more palatable, just another long list of interconnected tasks presented in a slightly different way.

Having said that there are a few complaints that I've seen here that have or had some vailidity, the biggest being

  • Documentation is poor/missing
  • Reproducible builds
  • Eclipse integration is bad
  • Bugs

To which my response is twofold. First, Maven is a much younger tool than Ant or Make, so you have to expect that its going to take time to get to the maturity level of those applications. Second is, well if you don't like it, fix it. Its an open source project and using it and then complaining about something that anyone can have a hand in solving seems fairly asinine to me. Don't like the documentation? Contribute to it to make it clearer, more complete or more accessible to a beginner.

Reproducible builds problem breaks down into two issues, version ranges and automatic maven plugin updates. For the plugin upates, well unless you're making sure when you rebuild a project a year later that you're using the exact same JDK and exact same Ant version, well this is just the same problem with a different name. For version ranges, I recommend working on a plugin that will produce a temporary pom with locked versions for all direct and transitive dependencies and make it part of the maven release lifecycle. That way your release build poms are always exact descriptions of all the dependencies.

11
votes

It deserves the reputation it has got. Not everyone needs the rigid structure that Maven's developers thought is appropriate for every single project. It is so inflexible. And what is 'Pro' for many people, the dependency management, is IMHO its biggest 'con'. I am absolutely not comfortable with maven downloading the jars from the network and lose my sleep over incompatibilities (yea, the offline mode exists, but then why should I have all those hundreds of xml files and checksums). I decide which libraries I use and many projects have serious concerns about builds dependant on network connection.

Further worse, when things do not work, you are absolutely lost. The documentation sucks, the community is clueless.

1
  • 4
    I agree with this. I think the value of the dependency-management is overstated. Sure it's neat when it all works but it introduces several potential failure points (not to mention potential security holes). You can setup your own repository server to mitigate the problems somewhat, and lock-down the version numbers to avoid unexpected updates, but I still prefer just adding the dependencies to version control since they don't change that often and it guarantees a repeatable build.
    – Dan Dyer
    Commented Jan 9, 2010 at 21:59
8
votes

A year later I wanted to update this: I no longer have this opinion about the Maven community. I would not write this answer if the question were asked today. I'm going to add my current opinion as a separate answer.


This is a very subjective answer, but the question is about opinions, so ...

I like Maven, and am liking it better the more I get to know it. One thing affecting my feelings about it, however: the maven community is largely centered around Sonatype ("the maven company", it's where many of the Maven honchos are working), and Sonatype is pushing its corporate products pretty aggressively on the community.

An example: The "Maven Book" twitter stream links to a supposed introduction to repository management.

Sorry, but that "intro" is half-information, half sales pitch for Nexus. Pop quiz: are there any other repo managers besides Nexus and Nexus Pro? Also, what does that have to do with the supposedly open-sourced Maven Book? Oh, right, the chapter on repository management has been spun off into a separate book ... about Nexus. Huh. If I contribute to the Maven book, do I get a referral fee if I cause an increase in Nexus sales?

Imagine if you were participating in a Java development forum and it was clear that the Sun employees discussing Java were going to seize every possible opportunity to talk about NetBeans and "NetBeans Pro". After a while, it loses some of its community feeling. I never had an experience like that with Ant.

Having said all of that, I do think that Maven is a very interesting and useful system (I'm not calling it a tool, like Ant is, Maven is broader than that) for software development configuration and build management. The dependency management is a blessing and a curse at times, but it's refreshing -- and certainly not the only advantage Maven offers. I'm probably reacting a bit too strongly to the Sonatype shilling, but it hurts Maven by association, in my opinion. I don't know if this opinion is shared by anyone else.

1
  • 2
    Zac, you know I was wondering if you wanted to learn more about Nexus Professional. :-) Commented Apr 14, 2012 at 11:19
7
votes

I think Maven gets a bad rap because it imposes structure on your project, whereas other tools such as Ant allow you to completely define the structure any way you wish. Agreed also that the documentation is bad, but I think primarily the bad rap that Maven gets is because people are so used to Ant.

4
  • 2
    I agree that initially people may miss the control they had with Ant, but once a project comes to accept the conventions that Maven imposes they will really see a gain in productivity from it. Commented May 14, 2009 at 3:31
  • 5
    Not true, Maven allows you to change the project structure, it just suggest a structure which is widely used. Commented Jun 3, 2009 at 13:40
  • 3
    I don't think this is true. Most of the complaints about Maven are about the ways in which it can fail, how slow it is or the documentation. I've never really noticed anybody complaining about the structure.
    – Dan Dyer
    Commented Jan 9, 2010 at 21:32
  • @Dan Dyer: I second that. The structure is actually one of few good things Maven does. It's everything else that makes Maven so horrible. Commented Jan 22, 2010 at 19:20
6
votes

Too much magic.

3
  • 3
    Be more specific - what is so magical about it that isn't documented?
    – whaley
    Commented Sep 7, 2009 at 13:21
  • 4
    It's magical as soon as you have to search the web during 2 hours to find out why something doesn't work as expected. If you want a specific exemple: why is my plugin not executed? You have 2 hours.
    – Damien B
    Commented Apr 26, 2010 at 9:27
  • Actually, whenever I am doing anything that doesn't involve searching the web for 2 hours, I start to become suspicious that I'm using the wrong tool for the job or I've severely misunderstood/understimated the requirements. Commented Sep 28, 2011 at 18:28
6
votes

Because unsatisfied people do complain while satisfied people don't say they are satisfied. My point is that there are far more satisfied maven users than unsatisfied but the later make more noise. This is a common pattern from real life too actually (ISP, phone carrier, transports, etc, etc).

5
votes

The single most important issue to me is that Maven, when not configured properly, may not produce repeatable builds, due to:

  • unreliable remote repositories;
  • dependencies on plugins and libraries with either SNAPSHOT versions or no versions.

Contrast this with an ant build which - although verbose and tiresome IMO - works since all jars are checked in locally.

The good part is that the problems are addressable:

  • use your own maven repository, which has become dead simple, I'm using Archiva with good results;
  • always properly version your dependencies. Maven has started locking down plugin versions in the super-POM starting with 2.0.8 or 2.0.9 and all your dependencies should be on released versions.
1
  • +1 for linking to an alternate repository implementation. Commented Aug 14, 2010 at 16:12
5
votes

great idea - poor implementation.

I moved a project from Ant to Maven recently. It worked well at the end, but I had to use two different versions of maven-assembly-plugin and maven-jar-plugin in the same pom (got two profiles) because what worked in one version was broken in another.

So it was quite a headache. Documentation isn't always great but I must admit that it was relatively easy to google answers.

make sure you always specify versions of plugings you use. Don't expect that new version will be backwards compatible.

I think controversy comes from the fact that maven still evolves and the process is painful sometimes.

regards

v.

1
  • I agree that the idea is better than the execution. It's not a small task they picked to their defense, but I regularly wonder whether things couldn't have been done in a more straightforward fashion.
    – Eelco
    Commented Sep 8, 2009 at 4:26
5
votes

I like maven. I've used it since pre 1.0. It's a powerful tool that on balance has saved me considerable amounts of time, and improved my development infrastructure. But I can understand the frustration some people have. I see 3 types of frustration:

  1. where the causes are real concerns (e.g. verbose POMs, lacking documentation),
  2. some is misinformation (e.g. "you have to have an internet connection to build" - not true - doin't, this can be avoided),
  3. some of it is vented at maven but really someone else is culpable ("don't shoot the messenger").

For the first case, real problems - well, sure, there are problems, POMs are verbose, documentation could be better. Yet despite this, it is possible to get good results with maven in quick time. I cringe every time I get a project built with ant, and try to import this into my IDE. It can take a long time to set up the directory structure. with maven, it's just a case of opening the POM file in the IDE.

For the second case, Maven is complex, and misunderstandings are commonplace. If maven 3 can find a way to address this complexity (or even perceived complexity) that would be good. maven does take a considerable investment, but, in my experience, the investment pays for itself quickly.

For the last point, I think the gripe about maven's transitive dependencies is probably the best known example.

Transitive dependencies are the nature of real software employing reuse. Windows DLLs, Debian packages, java packages, OSGi bundles, even C++ header file includes all have dependencies and suffer the dependency problem. If you have two dependences, and each uses a different version of the same thing, then you have to try to resolve that somehow. Maven doesn't try to solve the dependency problem, but rather brings it to the forefront, and provides tools to help manage the problem, such as by reporting conflicts and providing consistent dependencies for a hierarchy of projects, and in fact provides absolute control over a project's dependencies.

The approach of manually including dependencies with each project (one poster says he checks all dependencies into source control) is runing the risk of using the wrong dependency, such as overlooked updates when a library is updated without checking in updates for it's dependencies. For a project of any size, managing dependencies manually is surely going to lead to errors. With maven, you can update the library version you use and the correct dependencies are included. For change management, you can compare the old set of dependencies (for your project as a whole) with the new set, and any changes can be carefully scrutinized, tested etc.

Maven isn't the cause of the dependency problem, but makes it more visible. In tackling dependency issues, maven makes any dependency "tweaks" explicit (a change to your POM overriding the dependency), rather than implicit, as is the case with manually managed jars in version control, where the jars are simply present, with nothing to support weather they are the correct dependency or not.

5
votes

I believe that Maven has a bad rep because most detractors have not observed the combination of Maven + Hudson + Sonar. If they had, they would be asking "how do I get started"?

2
  • +1 for mentioning Sonar. Commented Aug 26, 2010 at 9:45
  • 1
    I have seen it. There is still no reason for using Maven. Hudson and Sonar dont need maven.
    – rk2010
    Commented Apr 27, 2012 at 22:01
5
votes

Some of my pet peeves with Maven:

  • The XML definition is super clumsy and verbose. Have they never heard of attributes?

  • In its default configuration, it always scours the 'net on every operation. Regardless of whether this is useful for anything, it looks extremely silly to need Internet access for "clean".

  • Again in the default, if I'm not careful to specify exact version numbers, it will pull the very latest updates off the 'net, regardless of whether these newest versions introduce dependency errors. In other words, you're placed at the mercy of other peoples' dependency management.

  • The solution to all this network access is to turn it off by adding the -o option. But you have to remember to turn it off if you really want to do dependency updating!

  • Another solution is to install your own "source control" server for dependencies. Surprise: Most projects already have source control, only that works with no additional setup!

  • Maven builds are incredibly slow. Fiddling with network updates alleviates this, but Maven builds are still slow. And horribly verbose.

  • The Maven plugin (M2Eclipse) integrates most poorly with Eclipse. Eclipse integrates reasonably smoothly with version control software and with Ant. Maven integration is very clunky and ugly by comparison. Did I mention slow?

  • Maven continues to be buggy. Error messages are unhelpful. Too many developers are suffering from this.

4
  • 2
    I've never had Maven pull the latest off of a dependency unless I was using a SNAPSHOT dependency or added a new feature that required something. If I ask for version 1.2.3, and I have 1.2.3 in my local repository, I don't get 1.2.3 again. Commented Jan 22, 2010 at 19:41
  • 1
    You control your direct dependencies, yes. Who controls your dependencies' dependencies? Commented Jan 22, 2010 at 20:24
  • For you're first point, about attributes, that is supposed to be addressed in the forthcoming, (for like a LONG time now I'll admit) Maven 3.
    – mezmo
    Commented Aug 25, 2010 at 18:18
  • @mezmo: That would be highly welcome. Thanks for the info! Commented Aug 26, 2010 at 9:27
4
votes

Good question. I've just started a large project at work and part of previous projects was to introduce modularity to our code-base.

I've heard bad things about maven. In fact, it's all I've ever heard about it. I looked at introducing it to solve the dependency nightmare we're currently experiencing. The problem I've seen with Maven is that it is quite rigid in its structure, i.e. you need to conform to its project layout for it to work for you.

I know what most people will say - you don't have to conform to the structure. Indeed that's true but you won't know this until you're over the initial learning curve at which point you've invested too much time to go and throw it all away.

Ant is used a lot these days, and I love it. Taking that into account I stumbled across a little known dependency manager called Apache Ivy. Ivy integrates into Ant very well and it's quick and easy to get basic JAR retrieval setup and working. Another benefit of Ivy is that it's very powerful yet quite transparent; you can transfer builds using mechanisms such as scp or ssh quite easily; 'chain' dependency retrieval over filesystems or remote repositories (Maven repo compatibility is one of its popular features).

That all said, I found it very frustrating to use in the end - the documentation is aplenty, but it's written in bad English which can add to frustration when debugging or attempting to work out what's gone wrong.

I'm going to revisit Apache Ivy at some point during this project and I hope to get it working properly. One thing it did do was allow us as a team to work out what libraries we're dependent on and get a documented list.

Ultimately I think it all comes down to how you work as an individual/team and what you need to resolve your dependency issues.

You might find the following resources relating to Ivy useful:

3
  • 1
    Ivy doesn't compete with Maven (maybe with Maven Ant Tasks, but not with Maven). Commented Feb 14, 2010 at 3:02
  • 1
    Ivy doesn't compete with Maven Ant Tasks, it competes with Maven dependency management.
    – Damien B
    Commented Apr 26, 2010 at 9:28
  • @atc This was right on!! : "I know what most people will say - you don't have to conform to the structure. Indeed that's true but you won't know this until you're over the initial learning curve at which point you've invested too much time to go and throw it all away."
    – rk2010
    Commented May 7, 2012 at 15:28
4
votes

I love Maven - it boosts productivity, and I am very happy that I am no longer using Ant (phew!)

But if I could change things it would be:

  1. Make pom.xml file less verbose
  2. Make it easier to include .jars not from the repository.
5
  • 1
    I think Maven users would be better serves by having the IDEs allow for importing missing or 3rd party jars into the local repositories. How hard would it be to have a "pick the jar click import" dialog box?
    – sal
    Commented May 14, 2009 at 17:42
  • @sal My guess is that Maven doesn't want to promote a practice that breaks portability. Commented Mar 16, 2010 at 23:14
  • 1
    I consider the fact that it's hard to add jars from random places to be a strength. If you're in a team environment, and you need to use an odd jar, you should be deploying that jar to your team's maven repo. That way, the rest of the team and your CI servers will be performing the same build. Everybody runs the same build is a foundation of the maven philosophy.
    – tunaranch
    Commented Aug 10, 2010 at 3:06
  • +1 for the jar thing. Bringing your own prebuilt jars in a build (for any reason) is an unneccesary pain. Commented Jun 15, 2012 at 9:47
  • @tunaranch personally I like that either stuff is in Maven Central or it is (jars and all) in what is being checked out from version control. Basically I want to be able to bring my git repository on an USB-drive, check it out, run "mvn clean install" and go to lunch and be up and running. Commented Jun 15, 2012 at 9:49
4
votes

There are lot of reasons why people don't like Maven, but let face it they are very subjective. Maven today with some good (and free) books, better documentation, biger set of plugins and lot of referential succesful project builds isn't the same Maven as it was one or two years ago.

Using Maven in simple projects is very easy, with bigger/complicated ones there is need for more knowledge and deeper understanding of Maven philosophy - maybe in company level a position for Maven guru like network admin. Main source of Maven hates statments are often ignorance.

Another niggle for Maven is lack of flexibility like e.g. in Ant. But remeber Maven has set of conventions - sticking to them seems to be hard in the begining, but in the end often save as from problems.

Current success of Maven proves its value. Of course nobody is perfect and Maven has some cons and its quirks but in my opinion Maven slowly sways his opponents.

1
  • @Pascal. In case problems with Maven there is a stackoverflow and you here :)
    – cetnar
    Commented Jan 9, 2010 at 22:00
3
votes

I wouldn't say it has a bad rep so much as it has a mixed rep. If your project follows the "convention over configuration" paradigm advocated by Maven then you can get a lot leverage out of it. If your project doesn't fit well into Maven's world view then it can become a burden.

To that end, if you have control over the project, then Maven may be the way to go. But if you don't and the layout is determined by someone not a fan of Maven, it may be more trouble than it's worth. The happiest Maven projects are probably the ones that started as Maven projects.

2
  • "I wouldn't say it has a bad rep so much as it has a mixed rep" - I'd say that's probably more accurate, only negative opinions tend to stick out more.
    – Dan
    Commented May 14, 2009 at 3:27
  • I agree that porting a project to maven increases in difficulty experimentally relative to the project size (bigger project to import = harder import). using maven to start a project is the best approach to using maven. Else it might not be worth the effort.
    – Luigimax
    Commented Dec 31, 2009 at 1:21
3
votes

To me, there are as many pros as there are cons to using maven vs ant for in-house projects. For open source projects however, I think Maven has had a great impact in making many projects much easier to build. It wasn't too long ago that it took hours get the average OSS Java (ant based) project to compile, having to set a ton of variables, downloading dependent projects, etc.

You can do anything with Maven you can do with Ant, but where Ant doesn't encourage any standards, Maven strongly suggests you to follow it's structure, or it'll be more work. True, some things are a pain to set up with Maven that would be easy to do with Ant, but the end result is almost always something that is easier to build from the perspective of people who just want to check out a project and go.

3
votes

If you're going to bet your business or job on a development project, you want to be in control of the foundations - i.e. the build system. With Maven, you are not in control. It is declarative and opaque. The maven-framework developers have no idea how to build a transparent or intuitive system and this is clear from the log output and the documentation.

The dependency management is very tempting since it could same you some time at project inception but be warned, it is fundamentally broken and will eventually cause you a lot of headaches. When two dependencies have incompatible transient dependencies you will be blocked by a rat's nest of complexity that will break the build for your entire team and block development for days. The build process with Maven is also notoriously inconsistent for different developers in your team due to inconsistent states of their local repositories. Depending on when a developer created their environment, or what other projects they're working on, they will have different results. You'll find that you're deleting your entire local repository and having Maven re-download jars far more often than the first time setup for a dev branch. I believe OSGI is an initiative that is attempting to fix this fundamental problem. I would say that perhaps if something needs to be so complex, the fundamental premise is wrong.

I've been a maven user/victim for over 5 years now and I have to say that it will save you far more time to just check your dependencies into your source repository and write nice and simple ant tasks. With ant, you know EXACTLY what your build system is doing.

I've experienced many, many lost man weeks of time at several different companies due to Maven problems.

I've recently tried to bring an old GWT/Maven/Eclipse project back to life and 2 weeks of all my spare time later, I still can't get it to build consistently. It's time to cut my losses and develop using ant / eclipse me thinks...

3
votes

The short answer: I've found it very difficult to maintain a Maven build system, and I would like to switch to Gradle as soon as I can.

I've been working with Maven for over four years. I would call myself an expert on build systems because in the last (at least) five companies I've been in, I've done major renovations on the build/deploy infrastructure.

Some of the lessons I've learned:

  • Most developers tend not to spend a lot of time thinking about build systems; as a result, the build turns into a spaghetti mess of hacks, but they do appreciate it when that mess is cleaned up and rationalized.
  • In dealing with complexity, I would rather have a transparent system that exposes the complexity (like Ant) than one that tries to make complex things simple by imposing rigid restrictions, like Maven. Think of Linux vs. Windows.
  • Maven has a lot of holes in functionality which require byzantine workarounds. This leads to POM files that are incomprehensible and unmaintainable.
  • Ant is super-flexible and understandable, but Ant files can get pretty big too, because it's so low-level.
  • For any significant project, developers have to create their own build/deploy structure beyond what the tool provides; the suitability of the structure to the project has a lot to do with how easy it is to maintain. The best tools will support you in creating a structure and not fight you.

I've looked into Gradle a bit and it looks like it has the potential to be the best of both worlds, allowing a mix of declarative and procedural build description.

3
votes

It's more complicated than the language you used to write your project. Getting it configured right is harder than actual programming.

3
votes

I've struggled my way through most/all the negatives mentioned here, and similar objections from teammates, and agree with them all. But I've stuck it out and will continue to do so by holding firm to the one objective that only maven (or gradle perhaps) really delivers on.

If you're optimizing for peers (open source developers), ant/make/whatever will do. If you're delivering functionality to non-peers (users), only maven/gradle/etc will do.

Only maven lets you release a small bundle of source code + poms (no embedded lib/binary dependency jars with cryptic names and no dependency info) with a well documented standard project layout that can be loaded by any IDE by someone that hasn't absorbed the developers' idiosyncratic layout conventions. And there's a one-button install procedure (mvn install) that builds everything while acquiring any missing dependencies.

The result is an easy on-ramp those users can follow to find their way into the code, where the poms can point them to relevant documentation.

Apart from that (indispensible) requirement, I dislike maven as much as anyone.

Not the answer you're looking for? Browse other questions tagged or ask your own question.