I've got a plugin I'd like to donate to Mojo, if there's interest - I've named it rev-maven-plugin, and it's got one goal: properties

The plugin simply generates a properties file that contains a property for the maven project version number, and (optionally) the SVN revision number. We have used a similar thing on some other projects (just an antrun script that shelled out to "svn info", actually) to generate such a properties file for all of our HTTP services for a while - our applications load the properties file, and expose a / version.txt URL so we can quickly verify exactly what version and SVN revision a running server in our system is on (the SVN revision number is particularly useful when we're deploying SNAPSHOT builds to our staging servers...) Another use we've found for it is to incorporate the version and/or revision into group names for a cluster of servers that configures itself over UDP -- to make sure that only servers running the exact same version/revision of the code try to coordinate. Basically, it's just taking a snapshot of this bit of info that's available at build time, and storing it off somewhere where it can be used at run time.

Anyways, after chatting with Jason at JavaOne last week, I thought that this might be something that the broader maven community might find useful, so I spent a bit of time coding it up as a proper mojo, and to use the SvnKit subversion library for java instead of the wanky shelling out to SVN. It's a tiny plugin, pretty simple to grok and use. The properties file it generates looks like:

   yourproject/target/rev.properties
---------------------------------------------------------------------------------------------------
   #revision properties for YourProject, generated by rev-maven-plugin
   #Mon May 12 16:31:24 CDT 2008
   yourproject.revision=17
   yourproject.version=2.0-SNAPSHOT
---------------------------------------------------------------------------------------------------

I think I've dotted all the i's to make it a well-behaved mojo project (code style, all the basics for the site, etc.), so if there's interest I will zip it up and submit a JIRA issue to create it in the sandbox.

thanks!

 - Bryon

Reply via email to