Is there a way use the svn ant task to get the svn revision number of a working copy and put it into a variable?
I would like to add an entry in my Java manifest file which includes the svn revision number, e.g. 0.9.65361
where 65361
is the revision number.
Answer
Aha, I found this idea, which depends only on the svnversion
command-line utility in SVN.
<project name="ant-exec-example" default="svnversion" basedir="."> <target name="svnversion"> <exec executable="svnversion" outputproperty="svnversion" /> <echo message="SVN Version: ${svnversion}"/> </target> </project>
Here’s where it captures the version in an ant property:
<exec executable="svnversion" outputproperty="svnversion" />