Why does Maven have such a bad rep? [closed]
Solution 1:
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.
Solution 2:
- 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.
Solution 3:
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.
- Given a new developer joining a project:
- 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.
- The definitive guide to maven is a good introduction however.
I truly believe that it's worth spending a little bit of time getting to know maven.