I've gone ahead and committed something that does Bryan's suggestion: generates a /META-INF/revision.properties file and outputs the current Subversion revision number to it.

The org.apache.openjpa.conf.OpenJPAVersion class will load that file and store it in the static "REVISION_NUMBER" field, as well as output it when the main() method of that class is run.

It's not perfect, but it's better than not having the information at all. In the future, we might want to think about writing a Maven plugin that does this a little more smoothly.


On Aug 22, 2006, at 2:11 PM, Bryan Noll wrote:

I dorked with it some more, and got it to the point where it wrote out a properties file with the subversion revision info in it (a la David's example)... but then ran into a wall in terms of getting the scope of that property to hang around long enough to stuff it into. I hopped on the #maven irc at codehaus... and asked around... and it seems like it is simply not possible as of now. The only option I got was to manually create a MANIFEST.MF file that is under subversion control, then filter it so the correct value gets put in that way, but it seems cumbersome to me to have to manually maintain all those files.

The next best thing would be to simply stuff a an openjpa- version.properties file in the jar that contains a line like:

svn-revision=433722

Seems like a hack because its not actually going in the manifest where it would be ideal... but I guess the information is still there.

I'm not sure I like either of those options...

Marc Prud'hommeaux wrote:
Bryan-

FYI, I had played with this a little while ago ... I got the subversion revision number using the maven-antrun-plugin and xmlproperty task to parse the .svn/entries file, but I couldn't figure out how to pass the value of the property from the ant plugin to the global Maven properties so that it could be later embedded using the maven-jar-plugin. If you have any ideas on how to do this (maybe even by writing out a file from ant and reading it back in with Maven), that'd be great.

This xmlproperty code that I wrote is actually still in the top- level pom.xml, it's just commented out.



On Aug 14, 2006, at 2:14 PM, Bryan Noll wrote:

Patrick...

Looks like the OpenJPA version number is already getting tossed in there as:

Implementation-Version: 0.9.0

We can stuff a subversion revision number in there by using 'maven-jar-plugin'... I just have to play with it a bit in order to get a latest and greatest rev number.

Bryan Noll wrote:
Lemme take a crack at it...

Patrick Linskey wrote:
Hi,

I think it'd be nice if each of the modules could encode svn revision
number and OpenJPA version number information into the built jars,
presumably in a manifest entry. Does anyone have any knowledge about how
to coerce this type of info into jars in a mvn environment?

-Patrick






Reply via email to