Maven -version
"Use Maven, you silly old school grumpy developer!", they said.
"It'll solve all your dependency problems", they also said.
I hate them.
It's not that I dislike maven as such. It does fantastic job what comes to dependencies - when it works. It also does fantastic job when it doesn't work, but only when it gives you reason why you failed. When it looks like it's doing it job, but it quite isn't, I'll get back to my hating game.
Not to pile on to your problems, here's what happened so perhaps I can make you hate me less at least.
I was trying to compile a project in my OSX desktop and the tests started failing for no apparent reason. The very same project from the same source tree compiled nicely in a Linux desktop running Ubuntu and the tests ran fine.
First of all the poor mac was seemed to be missing a dependency that ought to have come transitively through the project pom dependencies. You might have an opinion on the transitive dependencies (I certainly do), so without going deeper into that subject let's just say the mvn depencency:tree (one of my favorite maven plugins) told me that it's not there, nor was the jar associated it ever finding its way to the target lib directory.
Maven still wasn't my first suspect. I thought it must be something that the OSX does differently, but my colleague did immediately say with a laconic voice that: "It's probably just one of those issues with your stupid mac and maven versions".
He turned out to be right, at least on the maven part.
I checked the version on both workstations and in Ubuntu it showed version 3.0.4 whereas the mac showed 3.0.3, which is I guess the default that comes as bundled in. I did install latest maven with brew (http://mxcl.github.io/homebrew/) and it installed 3.0.5 out of the box.
Now, depending on your path settings, the /usr/local/bin might or might not be in the correct place, so check with "which maven" which is the one pointing to your binary. There's probably a symbolic link in /usr/bin/mvn pointing to your bundled one, so you want to either remove that or point it elsewhere.
The new maven package is probably located in: /usr/local/Cellar/maven/<mvn version>/libexec
This is probably information you want to tell your favorite IDE in case you'll ever need to point the maven home directory into it.
What you also might want to do is to do what many do with java, which is to point another symbolic link into your current maven version, assuming you're changed into that directory and say for instance:
[/usr/local/Cellar/maven] tiltti@sofia$ sudo ln -s 3.0.5/libexec/ current
After which you can point to your maven home dir as: /usr/local/Cellar/maven/current in IDE and other places statically. Just remind to update your symlink accordingly in case you do upgrades :)
Anyhow, after all this maven brewing, the jar found its way back to the project and all the tests were executed without problems.
Yay.
It still left me thinking my relationship with maven. I certainly don't miss ant... or actually I do miss it. But it's more like missing 4DOS for more nostalgic reasons than a reason that it's better what's out there.
Maybe it's because I've never really gotten kick out of being able to compile complex projects and do releases, and I hate everything that produces way much output than actual, useful information, that bugs me in general. It's like starting pretty much any J2EE container and looking at the puke it throws out to log files even at the default, preferred logging levels. And when it doesn't start, it's usually a missing class/jar file and a stacktrace anyhow that you need to start digging into.
What I wish maven would have is less verbose and more friendly output. And that people who do love the release would learn how not to make the project download ALL the dependencies in every single run without explicitly telling maven not to do so with -o option.
I'm rambling.
TL;DR Maven works if you're less stupid than me.
Ei kommentteja:
Lähetä kommentti