In Apache Ant, we can use the <exec> task to execute shell command in Ant script. Previously i have shown you how to integrate Apache Ant with SVN.
If you only want to do some simple SVN actions, you can consider using the <exec> task. The build.xml below is a simple example to get the current SVN version number.
<project name="ant-exec-example" default="svnversion" basedir=".">
<target name="svnversion">
<exec executable="svnversion" outputproperty="svnversion" />
<echo message="SVN Version: ${svnversion}"/>
</target>
</project>
Try it out.
svnversion:
[echo] SVN Version: 1178M
BUILD SUCCESSFUL
Total time: 1 second
Done =)
Reference: Apache Ant – <exec>

One thought on “Apache Ant – Get the SVN revision number by exec task”