8 ms·
Why I don’t like Maven
- lsd5you 14y agoI happen to think that maven is a good idea in principle, but poorly designed. One fundamental issue is that it does not distinguish between what I call 'products' and 'modules'. Modules have transitive dependencies and tend to have a common structure, and products do not. When you are building a product (e.g. an installer, some documentation, a website ... etc.) with the build tool, what you create is an artifact, that once built you can treat independently of its dependencies. A module is library code, and when you depend on it you implicitly depend on its dependencies as well. Build languages/dsls are a complete intellectual cul-de-sac. Java is a perfectly acceptable (in fact quite decent) language for doing build tasks. There is nothing in ant that cannot be equally concisely written in java, given the right library support. I have written more this subject in the articles on the website. http://www.ebuild-project.org/ http://www.ebuild-project.org/ The website is not completely upto date, the latest version is 0.8.4.
- Evbn 14y agoJava is unwieldy as a configuration language. Python (or a restricted subset) is a lot cleaner. But to replace Java by XML (as ANT/Maven does) doesn't help.
- lsd5you 14y agoI think this misses the point. Grouping ANT/Maven together because of XML is a very superficial association to make. ANT despite what it claims is essentially an inflexible programming language, which offers very few benefits over java (and many disadvantages), except that it is interpreted (not compiled), has a library of build tasks and can be stuck in the root of a project without looking like source code. XML is a big issue in ant because it is a very poor choice for writing a programming language. Maven is a build framework, into which you make your program fit, by decomposing it into maven projects ... etc. etc. XML is a perfectly good choice for configuration here. The core problem with Maven is poor design. For one, it has tried to make things simpler than they are, and does not recognise that some programming projects are fundamentally not amenable to a module structure (i.e. what ebuild calls products). It also makes developing across the dependency boundary (i.e. your program + the library) very cumbersome indeed.
- ExpiredLink 14y ago> Maven assumes there is one right way to build for everyone People who accept this are (the majority of) happy Maven users. People who fight Maven write angry blog posts.
- mjt0229 14y ago...in 2010.
- threeseed 14y agoSo true. Maven is the PostgreSQL of build tools.
- ArtB 14y agoI fail to see the connection... please explain.
- johlrogge 14y agoTo be fair, I didn't really want to write the post back in 2010 but I was convinced to do so. I was and still am pretty happy simply not using Maven :)
- smoyer 14y agoI love Maven and have been what I'd call a power user for at least five years. However, the first time I heard of it (and tried it), I hated it. Until you get your head around the idea that you're describing "what" you're building rather than how to build it, you'll feel an impedance mismatch. And I didn't begin to feel mastery with Maven until I started writing plug-ins. If you really want to understand your tool, then try extending it. I've never had issues with Maven builds missing files, etc. and I'm not really sure how that happens. On the other hand, the fact that the project structure is almost always the same from project to project lets me successfully dive into projects I've never touched. But Maven can be complex, especially if you're not careful to segment your project into sub-projects and modules. There are parts that are best learned by working with someone who's already mastered the build system. In any case, I think make/autoconf are harder to grasp than Maven, and I've never hated it the way I do when I'm programming in XML (Ant).
- sreque 14y ago"Until you get your head around the idea that you're describing "what" you're building rather than how to build it, you'll feel an impedance mismatch." Trust me, us maven haters understand declarative programming just fine. There is no impedence mismatch. Maven the build tool is simply an inferior solution with several superior alternatives. After discovering Buildr, I've never wanted to go back to Maven, and I'm willing to trust that Gradle (Groovy), Leiningen (Clojure), and SBT (Scala), are all also superior to Maven while integrating well with Maven's dependency system.
- smoyer 14y agoDependency management in Maven is amazing ... yet I don't find myself wanting to go back to Ant with Ivy.
- jamieb 14y ago"I'm willing to trust that Gradle (Groovy), Leiningen (Clojure), and SBT (Scala), are all also superior to Maven while integrating well with Maven's dependency system." Except that they don't. They can consume it, but they can't produce it. Or do they make pom files now? Or do you not care about pom files because you'll never publish your source?
- jhawk28 14y agoMost of these issues have been fixed with Gradle. Gradle still has some immaturity issues, but its overall a better system that takes the good parts of maven like dependency management and build environment conventions.
- v1r3n 14y ago+1 for Gradle. Yes, it is still quite new, but in return the documentation is pretty good and when you want to do something, that is not available out of the box, extending is quite easy. And yes, groovy rocks!
- vorg 14y agoGradle would do well to ship with other languages to increase share with those who want to use a more professional language with it. The big problem with browsers is they're limited to Javascript.
- pootch 14y agoWhy have we standardized on a tool which almost no one likes? Are we frickin sheep?
- rtperson 14y ago> I especially find Maven unreliable in combination with eclipse. Well there's your problem right there. Use Maven with Netbeans, and the integration between the two is so slick you'll wonder why you didn't use it to begin with. My biggest complaint in Netbeans now is that it doesn't have equally slick support for SBT and Gradle, but that's just because I've been spoiled.
- johlrogge 14y agoActually, it's one of the problems, not /the/ problem. There were many more listed :) I would really like to sit down with a netbeans fan to convince me. I have tried my hands on it a few times but I never understood why some people use it. Intellij, sure, netbeans... not convinced :/
- Gravityloss 14y agoI like the style of this article. It is confident yet has simple humility and openness. One rarely sees that. For example, when I write or talk about some piece of software, it tends to be either the best in the world or incomprehensibly incompetent.
- johlrogge 14y agoThank you! That was really nice feedback. I'm glad you liked it
- X-Istence 14y agoMaven in my experience may simply be an extension of Archive.org ... at least it feels that way when I run mvn on some of the Java projects at work and I download half the Internet before the build even starts...
- cletus 14y agoOh my God I'm sick of people equating IDEs (in the negative sense) with Eclipse. This goes beyond this post (eg typically emacs/vim users make judgments about IDEs based on having once used Eclipse). But take this statement: > I especially find Maven unreliable in combination with eclipse. Indeed. I have first hand experience with this. My team has a diehard Eclipse user who has added a bunch of random configuration plugins to Eclipse basically to make Eclipse work with Maven. Compare this to IntelliJ. You can open a Maven project (even a multimodule Maven project) directly in IntelliJ. There is no project importing/conversion. It just works with the native Maven project model. There are plenty of things to dislike about Maven but this isn't one of them. The author is correct about Maven documentation generally being terrible. At one point I wanted to do something as simple as creating symlinks in the target directory instead of copying files. This would greatly ease doing Javascript development, for example. Well there's a Junction plugin for Maven that alleges to do this. However it hasn't been updated since 2007 and relies on something no longer in a Maven repo that I could find. But here's the point I most disagree with: > Maven assumes there is one right way to build for everyone A lot of people have this opinion (and prefer Ant, Gradle or something else as a result). I do not share this view. I like that Maven is opinionated about things like project structure. Why? Because left to our own devices engineers are terrible at making these sorts of decisions. We all have a tendency to focus on some weird aesthetic and overstate its importance at the detriment of consistency across teams and projects. I've had this argument with coworkers in relation to us having a very strict style guide for our code [1]. Opponents call this an obstacle getting in the way of getting something done and it has a cognitive cost of internalizing what is essentially useless information and arbitrary standards. Obviously said people haven't worked in a large engineering organization where different teams would otherwise have different line lengths, curly brace styles, indenting levels and so on. It's a good thing there's a central set of conventions for this stuff. It avoids pointless "wars" about where curly braces should go. I feel the same way about Maven's archetypes. Fact is, you can look at any Maven WAR project and know where to find pretty much everything. You can't say the same about any Ant project. Just like with code style, people have an exaggerated view that their particular way of doing things is right and super-important. Being consistent is often more important than being right. Being right is subjective more often than it isn't. In the end the author states: > I think Maven works fine but in the past some logical choices have been made that do no longer make sense which kinda makes and misses the point. He's right in that it does work fine for all its warts. But changing things like XML (for YAML or SBT's DSL or whatever) is pretty much a change for change's sake at this point. Maven is one of many tools that isn't cool but is certainly good enough. There are really bigger things to worry about. How much time do you spend editing build files anyway? [1]: https://code.google.com/p/google-styleguide/ https://code.google.com/p/google-styleguide/
- pswenson 14y agoOnce again, java could stand to learn from Ruby. Maven is terrible for automation (XML is a lousy scripting language). Gradle? It's better than Maven, but they picked the wrong scripting language. Builds should be interpreted, not compiled. It's painful to leverage code that you need to build as you are in a catch 22 situation - can't reference a class in a gradle file that hasn't been built yet.
- DavidPlumpton 14y agoMaven is ideal for when teams of programmers work on a number of projects. How do you build this project from long ago? How do I set up a new dev machine? I'm moving to this new project, how does it work? We've got a new guy starting tomorrow, how will he know what to do? etc. etc. I suspect most people who criticise maven haven't worked in corporate environments where there are just a lot of projects, a lot of people, and a lot of churn (both in people and projects). That's where maven is a life saver.
- crdoconnor 14y agoEverything I hate about Java in some way traces back to the idea that "making it like this will make it more suitable to corporate environments". Corporate environments want droneish, politically correct, interchangeable programmers who very rarely step outside of their predefined, straitjacketed roles.
- johlrogge 14y agoEnterprises tend to put too much value in conformity and to little value in people's time. I have certainly worked in large corporate environments with lots of projects. Both those who thinks that there is value to optimize for the average and those who understands there isn't. I think most people that criticize Maven do so because Maven does not help them do their job to the extent Maven should. Enterprises don't really need enterprise tools but you need an enterprise to use enterprise tools...
- hobb0001 14y agoI've beat this drum before, and I'll beat it again here. The build configuration for every large project eventually becomes turing complete (requiring loops, conditionals, subroutines, what have you). Why is it then, that every new build tool that comes to town is declarative? Just give me a nice library full of handy build functions and I can write a build script in fewer lines than any build tool configuration -- and be more readable to boot.
- stiff 14y agoThe idea of describing a build in XML is so ridiculous only Java people could have invented it, "why I don't like Maven" is hardly interesting, "why the hell would anyone like Maven" is a good question. If you remember Linus Torvalds describing CVS vs. Git, I think you could say the same of Maven vs. anything actually reasonable.
- konradb 14y agoIs it verbosity that makes it unreasonable to you? What would your ideal way of describing a build be?
- toolslive 14y agoIt has been a long time since I used maven, but I used to be a user. The biggest problem with maven (except for quality, which I think is temporal) is that you cannot reproduce a build. The simple task of 'given a jar artifact(1), and its md5, full source code and pom, reproduce it from scratch' never works. (One of the reasons being the jar tool that stores .class file dates inside the jar). Another reason is that maven self-updates, and sometimes this gets in the way of being able to build an older project. I'm pretty sure there are several jars in biblio that cannot be recreated (never mind the md5) without significant hacking. (1) there is a difference between 'artefact' and 'artifact', but somehow the semantics became confused.
- bni 14y agoOne thing I dont get about maven is why the version number get embedded in the jar's filename. Everything has to be rebuilt when you switch to a new branch that has a different version number, deployed files cant just be "copied over" etc. Seems a huge impediment to any kind of efficient deploy system. I am not that well versed in build systmes, but I have never seen another build system that does this. Usually version numbers is stored in some meta data not in filenames.
- ubersoldat2k7 14y agoWhat I find most of new users of Maven fail to grasp is that it's not designed to work as Ant or Make. There's a reason jelly support was dropped in M2 The best thing about Maven is that once you understand what it's supposed to do, it does a great job at it. But when you find your self doing more custom stuff, it's better to extend your build process with the tools which are designed for this and let Maven handle the stuff it does fine. And yes, Maven support in Eclipse is... crap, because Eclipse is designed around Ant-like tools. Sorry to the guys who maintain the m2-plugin because it has to be a lot of work, but if you're using Maven, you'd better go with NetBeans or any other IDE. In my case, I do all the builds from the CLI and don't bother to integrate Maven with the IDE.