OK, now I see why people dislike Maven
Nothing like using something for yourself to clue you in to the buzz around it.
The buzz around Maven 2 is pretty negative. And now I’m seeing why. As my last post mentioned, I’m working on fixing the Maven build in the GWTJSF source tree. (Right now that source doesn’t build at all.)
I got the basic Maven compile working. Spent tonight on trying to get the tests working. Finally gave up when it turned out there were two critical problems:
- The GWTShell doesn’t like the Maven classloading pattern. Charlie Collins has a patch for this but it didn’t make it into GWT 1.4.
- Running GWTShell requires access to the OS-specific GWT native libraries. The current means for doing that is with system dependencies in Maven, e.g. download the appropriate GWT version and point your Maven POM at it. This is totally contrary to the entire point of Maven, which is supposed to download everything for you. Will Pugh is working on GWT-Maven support for downloading the whole native GWT archive and expanding it locally, but it’s not done yet.
So, fine, I gave up on getting the tests to run. Now I just want to verify that I actually have a working .jar file.
Turns out that I don’t, because the GWT compiler needs not just the .class files but also the .java files to be in the gwtjsf.jar file. The original Ant build for the GWTJSF project had no problem doing this, it was totally obvious and trivial how to do it. So, it should be trivial in Maven 2, right?
I found the plugin documentation page for Maven 2. This led to the documentation page for the jar plugin. Hmm, pretty sparse. How about the usage examples? Nope, nothing there about what the actual configuration options are, just some examples of signing (which isn’t at all what I want to do). But look! At the top, it says this:
If you want to use advanced configurations you should have a look at the Javadocs for MavenArchiveConfiguration.
Oh joy! But wait. If you click on that link, what do you get? You get a page titled “Maven – Page Not Found”, which amusingly enough includes a tag saying “Built by Maven”.
That’s what I call bad — when your own javadocs for your automated build tool have automatically generated broken links!
It turns out that I missed a plugin that was actually already in the POM for the project, namely the maven-source-plugin. This generates a separate JAR file containing the sources for the project. That’s not what I want — I want the JAR file to contain both the sources and the classes — but it seems to be the best I can get Maven to give me.
Overall, it really seems that Maven has an incredibly fragmented configuration model, plugins with very, very specific functionality that is hard to override, and documentation that is scattered and broken. Sigh. Oh well, once I land this I’ll do my best to be done with it. Here’s hoping the Maven team can fix some of this.
Edit: I will say that I like what Maven is trying to do. This POM Reference makes a lot of sense… having a higher-level description of your project is not a bad concept. But the execution and the documentation are fraught with peril.