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
- Print the groupId, artifactId, and version of the published artifact on the index of the site in a human readable form
- 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:
3 comments:
Taylor, you forgot the most important one - always publish your artifacts to the Maven repository and never remove them after that.
If you don't want to or can't publish to Maven central repository, then you can easily host your own repository, but then you need to tell the user what that repository is located. It is not a rocket science either.
I usually make a stop at mvnrepository.com when I'm hunting to see if a random library has been mavenized. And then it isn't so I upload it to my personal artifactory instance, which is hard to keep in sync but at least manages to decouple "keep up to date with external library" from a specific project.
Like your idea/post.
I would think that just the xml snippet would be sufficient (and preferred over the attribute format) unless I am too new to Maven to know why you do both; just my opinion-ion (sorry... King of Queens reference).
Thanks for sharing.
Post a Comment