Moving away from build.xml (and towards Maven2)
A little background: At a conference some time ago (ommitting details, protecting innocents), a self-proclaimed Java / Open Source advocate Speaker was commenting on his build process: with a gleam of pride in the eye, he described a complicated (and "cool") system of symbolic links to keep things organized and current. End users? Downloading the most recent jars should keep you in good shape. Co-developers? Consider getting a "real" OS that supports symlinks (sorry, cygwin users, no-go).
"What about Maven??" I ask.... knowing the "right" answer. The speaker casts a wary glance my way: and without really responding, poo-poos that idea. (Since this was (one of many) off-topic digressions, I didn't pursue the thread...)
So, I thought I'd post a few notes in the ol' blog about Maven (perhaps a little series). 'Cause, once upon a time, I was in the exactly same "state of development" as that speaker. (We all walk a long path, grasshopper.)
Presently, I'm not going to do (yet another) tutorial, how-to, or rah-rah; there's plenty of those. I just want to give some context to the flood of technical information (and code) that's out there.
First, people ask, "Should I be using Maven?" The answer is pretty simple, really:
- if it's more work not using Maven, then, yes, use Maven (as opposed to that system of symbolic links, etc). Maven quickly and cleanly handles the external dependencies of your project.
- if you're causing more work for your users (ie, other developers, people building your project), then, please, take the time to look at Maven. I only need so many copies of Xerces/Xalan/Junit/etc on my tiny laptop development machine (namely, one)...
So, now that Maven 2.0 is in tech-review status, people will ask, "Should I be using Maven2?" Again, I'll skirt the issue (since it really depends on the project) and give some context:
- Regardless of whether you're still using Ant, Maven or Maven2, we've learned some things : Scripting Can Get Ugly. See: Thousands of lines of xml "scripting" (build.xml files in Ant; Jelly, in Maven plugins; or, maven.xml files that look suspiciously like build.xml files). Yeah, the docs always suggested writing Java (beans) and a little scripting "glue" as a means of implementing substantial new functionality... but, "it wasn't substantial when I started..."
- If you're using Maven or Ant today, see the Maven Best Practices document to be best prepared for Maven2 migration. Namely: don't write too much in maven.xml. Or, avoid one altogether. (Though, personally, I like a big ol' "Usage" statement in maven.xml as the default target, just to let people know what's going on.)
In short: if not adopting a certain technology takes more time than incorporating the technology into your project: then, by all means, sally forth. But also, consider others as well (esp. in open source community): if using a certain tool or technology is going to save others time and effort, then that will even have a greater payoff in the community as a whole.
- Login or register to post comments
- Printer-friendly version
- michael_n's blog
- 719 reads





