TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Why Everyone Eventually Hates or Leaves Maven

207 点作者 dfj225超过 12 年前

39 条评论

dasil003超过 12 年前
This is very eloquent distillation of the thought process underlying the evolution of my toolset over the last 5 years.<p>After having jumped into Rails and shifting from BBEdit to TextMate as my primary editor overnight back in 2005, when TextMate started withering on the vine I became disillusioned that I had put so much effort into pursuing such a short-lived tool.<p>Reflecting on my history with a UNIX shell going back to the late 80s, I realized that things I had learned 10, 20 years ago from the UNIX world were still relevant today. I committed myself to getting serious about vim because I want to optimize for A) learning many programming languages and B) not using verbose Java-like languages that require IDEs for the all the boilerplate and rote refactoring.<p>While this kind of toolset will never provide quite the bang for the buck of a contextual IDE in a specific language, it's a phenomenal hedge against all the career risks I face in terms of Ruby becoming irrelevant, the web becoming irrelevant, Apple nerfing OS X, or any other probable sea change. No matter what happens I feel like vim + bash will bring me an immediate level of productivity in any new task I face, even if I start flattening out before I reach the Eclipse or Visual Studio level of wizardry, I don't expect any one thing to last long enough in this industry for such optimizations to pay off.
评论 #5106860 未加载
评论 #5106841 未加载
评论 #5107231 未加载
评论 #5108724 未加载
ap22213超过 12 年前
It's a trade-off, right? As most things in software are.<p>Recently, I inherited a project that had 10,000s of lines of ant scripts. Resource constrained, I didn't have anyone to maintain that build process. So, I took a few hours and converted those projects to several hundred lines of maven 'scripts'. Now, it works way better than the previous system, because now I can have a person focused on coding features, rather than maintaining process.<p>Maven was what I knew at the time; and, it fit well enough. Maybe Grails is the right answer, though. Or, something else.<p>Anyway, ultimately, it comes down to what trade-offs we make and what things we prioritize with our limited knowledge that we have available. And, that is the art of software development.
评论 #5106326 未加载
评论 #5107705 未加载
mcherm超过 12 年前
I don't hate Maven, and I haven't left it yet.<p>But he is absolutely correct about the key observation: a basic tool with "plugins" is simply NOT the way to create a build tool. A built tool should allow (when needed) the full flexibility of a Turing complete programming language. Because eventually your project is probably going to need it.
评论 #5105988 未加载
评论 #5106249 未加载
评论 #5105691 未加载
评论 #5106823 未加载
评论 #5106788 未加载
berlinbrown超过 12 年前
If you look at the practical real-world environments, Maven beats out most other approaches for large projects. I think you have three or four different build setups. I prefer Maven for large projects and Ant for small projects. Up votes for the person that makes working, maintainable, easy to read and modify maven scripts. (not you Spring or JBoss).<p>Anyway, you have three levels of builds.<p>- Complex Perl scripts, bash/unix scripts : these people are insane and generally have degrees in physics and mathematics. They write scripts that are unreadable, can't modify, are cryptic and I imagine that that the authors can't read them. I sometimes see these in old Linux programs.<p>- Complex Make, Autoconf, bash/unix scripts : A little better than the perl build scripts but still a complex because you have to understand each command used. I am not fan and never was a C/C++ developer. I guess these are still used in the non-Java world. I am looking at you 'OpenJDK/Sun JDK'<p>- Complex Ant scripts : These aren't bad, easy read, a little bit difficult to maintain over time. I think most developers prefer Maven but don't mind an Ant script if the project is small<p>- Maven Scripts : I think people use maven because not much else exists. And the problem of compiling code is not that serious as the actual application development.
评论 #5108106 未加载
jamieb超过 12 年前
"These abstractions apply to tools and frameworks as well, particularly tools that must scale in their power and sophistication along with projects, like build tools. By hard-won lesson, composable build tools scale (in time, complexity, and usefulness) better than contextual ones."<p>And then the person that wrote them leaves and we're fucked. If maven doesn't do what you need to do, then chances are you don't need to do it. You may think you need to do it, you probably don't. Maybe what you need is a more powerful deployment system, or something that takes over after your java/scala/whatever is built.<p>If you're building perl, C, C++, sure, maven isn't going to do it for you. If you're building java, you're sorted.<p>My favorite is when this sequence happens (I have seen it first hand):<p><pre><code> 1. Maven is this external system that we have no control over. 2. We will write our own system that will be awesome. 3. Wow, look, every project uses our Build System! 4. Oh, look, someone on project X changed B.S. and now Projects A-N don't work! 5. We will lock down B.S. so only the one person who wrote it can change it! 6. ... 7. B.S. is this internal system that we have no control over! 8. ... 9. Can we add support for merging war files? 10. No that'll take weeks, and Bob isn't available anyway. </code></pre> I'm sure you can fuck that up just as well using Ruby. Go for it.<p>I work in a java shop currently. There's got to be a hundred of us. Every single one uses an IDE.<p>When I use maven, my IDE just works. eclipse, intellij, netbeans all support maven. Want to put a bunch of files in a common war to share? maven has a merge-war plugin and intellij and eclipse know what it means: they both build projects that copy the files just like maven would do. Better yet, as you edit those files, no matter where they are, both eclipse and intellij update the files in the deploy target and they are available when you refresh your browser. There is a huge amount of investment in making this stuff work. This is convention over configuration.<p>No tool can do this with Ant (or Ruby) unless it <i>runs</i> the Ant and the Ruby, and then you've side stepped the IDE and reduced them to dumb text editors. With an Ant project, the IDE can't know that when I edit file A, it is transmogrified into file Z. (If it could, it could solve the halting problem). With Maven, the IDE implements <i>convention</i>, and so it know that File A is compiled to File B and then must be copied to location Z because its part of a merged war. Add JRebel to the equation and pretty much any change to the code is immediately runnable. Its dangerously easy to spike away instead of writing tests!
评论 #5106933 未加载
评论 #5107169 未加载
评论 #5107393 未加载
评论 #5107412 未加载
评论 #5106906 未加载
评论 #5106929 未加载
tomlu超过 12 年前
I've worked on two build systems (and used many more). The conclusion I have arrived at is you don't want a declarative-only system (like Ant). They can be convenient but as your needs grow more complex they start becoming a hindrance.<p>Instead, you want general purpose language that builds the build dag using the build system as a library. This gets you control and customisability for free, and you can still get reuse through code libraries.
meaty超过 12 年前
Spot on post.<p>Last year replaced a maven shitfest with an old fashioned Makefile which calls javac and manual dependencies. The whole port process took about 2 hours.<p>Integration and test run time has gone from 7 minutes (to drag all the maven plugins and dependencies down) to just over two minutes.<p>This saves us a fortune on build agent capacity as well (we use TeamCity).
评论 #5106248 未加载
评论 #5106705 未加载
评论 #5106174 未加载
评论 #5107759 未加载
wellpast超过 12 年前
I wholeheartedly disagree with this post, though I do like his conceptual framework of composable and contextual abstractions.<p>I've worked on countless Maven builds and have done everything under the sun. Maven's plugin system allows you to ultimately achieve whatever you need out of your build--in the 10% case that you have a need that isn't already covered by the varied plethora of plugins out there. You can even call out to Ant using the antrun plugin.<p>I've found so much simplicity, reliability, continued payoff in my use of Maven. I've heard complaints but usually from people that refuse to understand how it functions declaratively.<p>Declarative systems like Maven ask that you learn something first, and then reward you infinitely if you do; imperative systems let you do something immediately without learning a model, but then make you infinitely pay for it.
评论 #5107775 未加载
Corrado超过 12 年前
I think the article title is a big provocative and is drawing attention away from the main point: composable tools are better (in the long run) than contextual ones. Maven (and Ant) are contextual tools and they give a lot of benefits early on. Extending their use beyond simple things tends to become difficult and makes very messy build/deploy code.<p>Tools like Rake and Gradle (and Buildr) are more like thin wrappers on a turing complete language and are able to stretch and bend to fit the problem. Sure, that makes them harder to get started with, but it provides much more runway when the build gets complicated.<p>I've used Maven in the past on some projects and it starts off very nicely. However, without fail, I end up with some part of the build that doesn't work quite right. Or throws unresolvable errors. Or just fails, some of the time. I guess I (and everyone I've ever worked with) sucks at Maven and just can't make it work. If so, that tells me much more about Maven than my team's abilities.<p>P.S. I (mostly) blame XML for my Mavin chagrin. Over the years I've grown to hate XML and everything associated with it. It should burn in a fiery pit of lava. But that's just me. :)
typicalrunt超过 12 年前
Oh wow. I just raged at my manager for exactly this type of problem.<p>I'm not sure if it's due to someone's lack of technical ability, or if they get distracted by other externalities, but we always tend towards something that seems really simple at first but instead incurs a lot of technical and process debt later on.<p>Brilliant read.
评论 #5106163 未加载
3amOpsGuy超过 12 年前
I enjoyed the article but I feel it overlooks one of the biggest reasons to use something like maven:<p>It gives us the language to efficiently reason about and discuss build concepts with colleagues.<p>This is a big thing, think about the most recent new starter situation you experienced, about how communication of these common build tasks was expressed. Chances are if it was with a more composable tool, the discussions were fairly detailed, the words 'just like' frequently appeared. If it was with a more rigid tool, the conversation would have been in terms that tool commonly defines.
dustingetz超过 12 年前
The compromise of composabilty is that if you don't already understand the problem domain, you don't know how to structure your code. Frameworks are brilliant for paving a golden path for us to follow - we get to reuse someone elses knowledge and experience, codified into the framework.<p>A great example is the present state of browser development t. Google "backbone sucks site:news.ycombinator.com" and you find tons of comments from people who struggle with backbone - a supercomposable <i>library</i>, not a framework by design.<p>Composabilty pays off huge in the long, but you need experienced leadership to wield it.<p>There's also a happy medium in things like Play Framework, a functional scala framework but designed almost as a collection of composable libraries so you can lean on Plays opinions for most things but since it is designed to be composable (compare to "pluggable", or "extensible") so you can swap different pieces out if you like. That is my experience, at least.
tomohawk超过 12 年前
I've found buildr (<a href="http://buildr.apache.org" rel="nofollow">http://buildr.apache.org</a>) to be a great replacement for maven. It provides many of the capabilities that maven does, but it's also got all of the power of ruby/rake for taking care of those things that come up that the plugin/declarative approach just cannot handle reasonably. We converted our maven builds in a day and never looked back.
andrewem超过 12 年前
Doug McIlroy's solution is genius, and I hesitate to try to improve it, but it seems to me that if you reverse the order of the 'tr' commands, then you can slightly simplify the one that turns non-word characters into newlines, like so:<p>tr A-Z a-z | tr -cs a-z '\n' | ...<p>Since you first turn upper-case characters into lower-case ones, you then get to replace only things that aren't in a-z with newlines, rather than things that aren't in A-Za-z. It saves a whopping three characters!
edwinnathaniel超过 12 年前
How about Maven 3 and Groovy DSL?<p><a href="http://www.mail-archive.com/users@maven.apache.org/msg126205.html" rel="nofollow">http://www.mail-archive.com/users@maven.apache.org/msg126205...</a><p>At least the people behind Maven took notice that there is a problem and working on something.
评论 #5106741 未加载
NeillAlexander超过 12 年前
"Once you start fighting with Maven, it’ll never return to the rosy days when your relationship was young."<p>The key is, you don't start fighting with Maven.<p>"The philosophy of Tai Chi Chuan is that if one uses hardness to resist violent force, then both sides are certain to be injured at least to some degree. Such injury, according to tai chi theory, is a natural consequence of meeting brute force with brute force. Instead, students are taught not to directly fight or resist an incoming force, but to meet it in softness and follow its motion while remaining in physical contact until the incoming force of attack exhausts itself or can be safely redirected, meeting yang with yin." (<a href="http://" rel="nofollow">http://</a> en.wikipedia.org/wiki/Tai_chi_chuan)<p>If you fight with Maven, you will lose. If you meet it in softness and follow its motion you will attain build enlightenment...
nichols超过 12 年前
better link: <a href="http://kent.spillner.org/blog/work/2009/11/14/java-build-tools.html" rel="nofollow">http://kent.spillner.org/blog/work/2009/11/14/java-build-too...</a><p>After about a year of experience with Maven, I find that:<p>* The "surefire" plugin is named ironically. The build often fails without a message about what unit test failed.<p>* Maven is extremely slow. Eclipse builds the source in 30 seconds max; Maven takes 5 minutes.<p>* Maven's output is extremely verbose, but if anything goes wrong, it "helpfully" tells you to rerun it with -X -e to get the actual error message and stack trace. You can run it with -X -e all the time if you want, but I think it generates so much output that it actually slows down the build. Yes, really.<p>* There are a lot of things you just CANNOT DO in Maven. One example is bundling a Maven plugin together with the rest of your Maven source and use that same plugin elsewhere in the project. It fails during the early phases of the default lifecycle because the plugin isn't installed yet. But only by getting to the later phases of the lifecycle can you install the plugin. But you can't do that because the early phases fail. An infinite cycle of despair is right.<p>* Even the most trivial project takes a few screenfuls of XML to set up in Maven.<p>* Maven's dependency management is poor, too. If you have some library A that pulls in B, and another library C that pulls in a slightly different version of B, you can get misbuilds. It's your job to identify and fix these problems. They will show up at runtime. And let's not even talk about SNAPSHOT and how horribly that can go wrong.<p>* Maven is also known for pulling in tons of unnecessary dependencies. But hey, you don't mind 50 more megabytes of jars on your CLASSPATH, do you?<p>I was honestly expecting the article to address some of these points, instead of vague philosophical ramblings. Seriously, Maven is horrible. This article gives you no inkling of just how bad it is.
pjungwir超过 12 年前
I was surprised to see him include ant with maven. I always thought of ant as more a set of composable tools than a maven-like context, and for that reason I preferred it.<p>That said, I recently had to use ant after many years doing Ruby, and I was surprised to find how many old annoyances were still there, like scarce/painful support for conditional execution. I wanted a task to `cp` in development and `scp/rsync` in production, and I wound up having to duplicate a lot of code. Also I'd have thought that someone would have added the copy task's filter support to scp by now. (If anyone knows a clean way to do any of this, I'd love to hear it.)
评论 #5106993 未加载
lifeisstillgood超过 12 年前
I completely agree with the thrust of this - I see frameworks over composability everywhere these days and it makes my head spin.<p>However we do not yet seem to plug http in the same way we pipe command lines. Something seems to be missing,
mathattack超过 12 年前
I love the Access analogy. It burned me quite a few times in prior lives, when every project started with, "Let's build an access database." Ultimately it's a tradeoff in abstraction and usability.
评论 #5107202 未加载
Uchikoma超过 12 年前
After 3 years of SBT for Scala development, which plainly does not work, b/c SBT developers do not like simplicity (the irony!) and are more interested in doing cool stuff than stuff that works, I'm only a small push away from going back to Maven/Zinc, that favors 'just works and you can't shoot yourself in the knee with an arrow' over 'powerful'.
评论 #5108435 未加载
politician超过 12 年前
The usual backstory is that the old thing was cobbled together over a period of time while the requirements shifted about underneath it. The new thing appears to be "more awesome++" because the requirements are fixed at that point in time. Inevitably, the new thing is forced to cope with changing requirements and the cycle repeats.
vorg超过 12 年前
What are the biggest differences between Rake, Gradle, and Leiningen? All 3 allow their respective language (i.e. Ruby, Groovy, Clojure) to be used within the build script, but besides the pros/cons and popularity of those languages, what are the differences between the build tools themselves?
Uchikoma超过 12 年前
Maven just works and if you stay within it's intent, it does it's job.<p>We use Maven with Bamboo for continuous integration and it just works. We play with the idea to move to Gradle b/c it's more powerful, but the effort is non trivial and the real benefits - beside the 'but it's programmable' - not clear.
评论 #5108428 未加载
hakaaaaak超过 12 年前
It's not Maven. It's Java and XML. They both end up involving much more overhead than Ruby/Rake.
评论 #5107834 未加载
评论 #5106663 未加载
sabalaba超过 12 年前
The author didn't provide any background about the original Knuth "Literate Programming" paper and subsequent review by McIllroy. Knuth was using that code to demonstrate Literate Programming style. While the quote / anecdote was taken a bit out of context, I agree with the fundamental idea: code reuse.<p>[1] <a href="http://en.wikipedia.org/wiki/Literate_programming" rel="nofollow">http://en.wikipedia.org/wiki/Literate_programming</a><p>[2] "Literate Programming" <a href="http://comjnl.oxfordjournals.org/content/27/2/97.full.pdf" rel="nofollow">http://comjnl.oxfordjournals.org/content/27/2/97.full.pdf</a>
huherto超过 12 年前
I totally agree with the article. I love somethings about maven but XML is a pain to work on.<p>I am thinking that a build system can be built on top of Java. But Java for shell scripting has some drawbacks that can be alleviated. I am working on these little tool to use regular java for shell scripting, it is auto compilable and it has better abstractions for file manipulation. <a href="https://github.com/huherto/jashi" rel="nofollow">https://github.com/huherto/jashi</a>
评论 #5106583 未加载
6ren超过 12 年前
I now use bash instead of ant. It's really fast, makes sense, does whatever I want.<p>But it has the lisp problem (and now ruby problem) of everyone making their own tooling, without standardisation. (where a "standard" is procrustean: it doesn't exactly fit any situation, but the situation is forced to fit it). Pre-chasm innovators/early-adopters love it; everyone else hates it.<p>BTW: I don't think "contextual" is a very descriptive term ("composable" is great though)
rjzzleep超过 12 年前
i'm really wondering, why xml is burried so deep down in the comments. I would argue that Maven is just reflecting a methodology implied by xml, some like it, but well...<p>this: <a href="http://www.defmacro.org/ramblings/lisp.html" rel="nofollow">http://www.defmacro.org/ramblings/lisp.html</a><p>even though having completely different intentions, shows the parallels quite well, imho
评论 #5107270 未加载
traxtech超过 12 年前
Imho Maven, despite its wide range of plugins and extentions mechanisms, is quite "convention over configuration" (cought cought) and really is made for projects that can adapt to its conventions, and to the popular Java artifacts layouts.<p>The problem is, when it does not suits you, the competition is not really well known. Gradle maybe ?
amalag超过 12 年前
I can't understand the Maven hate. People prefer their own half baked ant tasks which don't handle dependencies? IMHO Maven takes some getting used to, but it brings a lot to the table and can make the build process very repeatable and extensible.
jebblue超过 12 年前
Good article. I like the idea of what Maven tries to achieve but I prefer monkeying with ant because I can get things done. If Maven or its successor ever gets to where things can't get into a mucked up state; I'm in.
评论 #5107843 未加载
Niten超过 12 年前
&#62; Donald Knuth was asked to write a program to solve this text handling problem: read a file of text, determine the n most frequently used words, and print out a sorted list of those words along with their frequencies. He wrote a program consisting of more than ten pages of Pascal, designing (and documenting) a new algorithm along the way. Then, Doug McIlroy demonstrated a shell script that would easily fit within a Twitter post that solved the problem more simply, elegantly, and understandably (if you understand shell commands)<p>Fine anecdote, but anyone want to take a wager as to the relative time and space complexity of the two solutions? I imagine this is sort of comparing apples and oranges.
评论 #5108987 未加载
deltasquared超过 12 年前
For me personally, leinigin is why I don't use Maven that much ^_-<p>Also, you would be surprised just how much "Java" programming you can do with a decent XML editor. IDE's are overrated.
commentator超过 12 年前
I like this one:<p>What has Maven ever done for us? <a href="http://www.wakaleo.com/blog/what-has-maven-ever-done-for-us" rel="nofollow">http://www.wakaleo.com/blog/what-has-maven-ever-done-for-us</a><p>:-)
laureny超过 12 年前
It's hard to be wrong when you claim that you either eventually hate or stop using a software tool.<p>I can't think of many tools that escape this simple truth.
评论 #5108441 未加载
drivebyacct2超过 12 年前
I'll take rigid maven any day. Much preferable to some cobbled together build system that is undocumented and hard to reliably reproduce.<p>I'm curious what people are doing with Maven that they manage to get into such a fight with it? Although to be fair, due to issues in its dependency resolution mechanics, it can pull in incorrectly versioned artifacts without ever telling you anything.
评论 #5105801 未加载
评论 #5106490 未加载
评论 #5106723 未加载
评论 #5106978 未加载
评论 #5106006 未加载
moneypenny超过 12 年前
TLDR: Maven makes hard things easy and easy things really f<i></i><i></i><i></i> hard.
评论 #5106961 未加载
martinced超过 12 年前
I managed to do my entire Java career by dodging Maven but I'm now learning Clojure and I really like the language but, sadly, I'm not fluent enough in Clojure to do everything "by hand" so I'm using Leiningen...<p>And Leiningen uses Maven under the hood :-/
评论 #5106285 未加载