Posted by chetan on March 30, 2010 in projects

Today I’m launching my latest personal project,, to help Java developers find Maven artifacts. It’s also the first project I’ve finished* and released in a very long time.

The Problem

While Maven is, at it’s core, a build system, one of the most valuable features it offers is it’s centralized repository and transitive dependency management for your projects. You can simply include an artifact definition and Maven will, at build time, download and provide not only the selected artifact, but all it’s dependencies as well.

The problem is actually finding definitions for your artifacts, specifically when you already know the name of the library or project. You would think that a popular project like Spring would include this information somewhere on their download page, but for some odd reason they don’t and neither do most other opensource projects.

Existing attempts

As it turns out, I’m not the only one with this problem; I found at least 7 different sites that try to solve it. All of them appear to have taken a similar approach and yet offer wildly different results.

As a test, try searching for “struts” on each of them and see if you can locate the correct artifact id for the latest version.

Were you able to find Struts I wasn’t.

My Solution

Enter, my attempt at building a search engine for Maven artifacts. With srchmvn I offer two key improvements over existing solutions: a clean, speedy interface and an improved search algorithm. Specifically, rather than relying solely on a simple keyword search, I also take into account a given artifact’s “popularity” in much the same way that Google determines Page Rank. In this case, I’m using Maven’s own dependency system to determine which artifacts are referenced more often than others.

Now let’s try that search again, shall we?

Ah, much better. Exactly what I was looking for. The latest versions of both Struts 1.x and 2.x in the top 3 results, followed by several other popular artifacts.

Fun Bits

Other than scratching an itch I’ve had for the last couple projects I’ve worked on, building srchmvn gave me a chance to play with things I generally haven’t had a chance to use at work, like Rails 3 beta, nginx, Capistrano, and jquery.

I’ve had a love/hate relationship with Rails over the years and I was hoping to find out if any of the “hates” had been addressed in this latest version. I can’t say I’ve done much more than simply kick the tires on this thing, but so far I’m not blown away. The rails team has done a remarkable job in refactoring the monolithic codebase that rails had grown into, but my biggest complaint has always been the use of [generally] undocumented “magic” behaviors, and they’re still here, for better or worse.

Surprisingly, the area that gave me the most trouble, and where I spent the most time, was in trying to correctly parse the Maven project (POM) files. Of course, anyone who has ever had to write or maintain one will know exactly why that is… :-)

*Not Quite Finished

Ok, so it’s not quite finished. I have a few ideas on ways to improve various bits of the app, but more than anything, I’d appreciate some feedback. I’ve so far been able to quickly find every artifact I’ve thrown at it, but if you happen to find some cases where you get weird results, please let me know. I’ve got some ideas on improving the search as well, but unless I see a need to tinker with it, it probably won’t be changing for now.