Tuesday, February 12, 2008

Time for a Maven Best Practice

I really like Maven. I think the idea is really solid, and I love the outcome of a project that is factored so well that you can have a working demo in an 80k download. That's really powerful! I use this power to my advantage all the time, building demos for Terracotta that can demonstrate with almost no effort how Terracotta gives you a high performance clustered cache, or can give Hibernate a performance boost.

That's awesome stuff, so awesome that I find I just can't code a project with "hard" dependencies anymore. If I can't download your dependency from my pom.xml, sorry man, it doesn't exist.

Which is where the frustration comes in - and a time for a best practice to start. Have you ever come across a new library you want to try out, but cannot find the groupId, the artifactId, or the version that corresponds to the dependency download? For a while I thought I was the only one...If I just knew these three "coordinates" I could get on with the job at hand...Instead I get bogged down hunting through some obscure project website, svn'ing code and the like. Ughh! Turns out some colleagues at Terracotta agreed, and we realized there has to be a better way.

Well, it's not rocket science, but we figured just printing out the info on the site would do. So, I present to you the Terracotta Maven best practice, implemented for your convenience on the Terracotta Forge. Every project published by Terracotta is required to have a "Maven Coordinates" section in the index page.

Terracotta Maven Best Practice

  1. Print the groupId, artifactId, and version of the published artifact on the index of the site in a human readable form
  2. Print the groupId, artifactId, and the version of the published artifact on the index of the site in a pom.xml compatible form

Here's what it looks like in practice: