Wednesday, March 25, 2009

Confessions of a Lazy Programmer: Maven the Easy Way


I have been brushing up on a few different technologies lately, and all of the tutorials & books I have gone through rely on Maven for building a project skeleton. Since my focus hasn't been on Maven itself (instead it is Spring and Tapestry), I have been blindly following instructions from the command line. For very basic projects, this has worked fine.


Anything more complex, and I see things like this:
Since I wasn't trying to set up any database connectivity, this is thoroughly annoying. I was only trying to validate that I can build a skeleton project so I can move on to installing and configuring the Tapestry plug-ins for Eclipse.

Since I'm not interested in learning the guts of Maven yet, I did what any good (read: "lazy") programmer would do: I installed the Eclipse plugin for Maven and used Eclipse to create my project. Thanks to Borut BolĨina's great walkthrough, this only took a few minutes. (He has a complete series on creating apps with Tapestry on his blog - encountering this problem gave me another resource to speed my learning.)

This was a much simpler task, since I was able to choose the archetype (i.e., type of skeleton I want to create) from a list. That list is populated by other lazy programmers who built and maintain the Nexus Indexer. This component is used by Eclipse (and via a command-line tool I didn't try) to link the repositories together for me. The upshot is that I can create a skeleton in minutes instead of spending hours or days learning Maven well enough to do it "the right way."

I have used the word "lazy" a lot in this post. To me it simply means that I don't spend time working on things that aren't relevant to the task at hand. The helpful and generous people who built the tools and documentation mentioned above fit this definition of "lazy" as well. For the most part, they built tools and wrote walkthroughs because they needed to in order to advance their own projects. They refined their work and made it available to others to improve it further. They stay engaged with people who use it for the same reason most skilled people do - because helping others by being an authority on the subject is one of the biggest rewards for building expertise in the first place.

I still need to learn Maven reasonably well to use it as part of a continuous integration environment. I may find that there is a subtle beauty and creativity-enhancing magic to using it from the command-line. I just don't need to spend hours screwing around with it right now, while I'm working through the basics of Tapestry.

Really. It's on my to-do list. I'm sure I'll get to it...someday...

(Lazy Dog image by Hector Garcia)