Apache Ant – Get the SVN revision number by exec task

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>

Advertisement

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.