Categories
discuss

using ant svn task to get the version of a working copy?

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 …

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" />
Source: stackoverflow
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Privacy Policy, and Copyright Policy. Content is available under CC BY-SA 3.0 unless otherwise noted. The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 © No Copyrights, All Questions are retrived from public domain..