I see questions like How to get revision number from subversion using maven? but are there any standards (defacto or otherwise) for which actual fields to use in the manifest, for the version # and for the repository URL (i.e., showing that it's on the trunk vs. a branch)? I've seen Implementation-Version used, with and without a leading "r" (for revision), I've seen Implementation-Build: used as well.
edit I removed the maven tag, that shouldn't have been there. My question is about the jar contents, not the tooling per se.
Unfortunately, jar manifests by itself do not have any standard for version numbering.
But, actually, there is another standard way of getting revision number updated automatically. You could use svn:keywords in order to get current revision number in your files after each commit. There is
$Revision$
property for revision substitution and$HeadURL$
for repository URL substitution. You just need to put following string into the file and place this file under version control:If you create manifest on the fly with maven, I would recommend putting following content into
version.properties
file:Then include in into
pom.xml
with the statement (maven should have properties plugin enabled):And then you will be able to put revision number and repo url to the manifest:
Please also note that you will need to explicitly enable
svn:keywords
using subversion properties in order to get$Revision$
and$HeadURL$
substituted in your file with actual values. If you will decide to useversion.properties
, you will need to run following command: