Using ant svn task to get working copy version?
Yep, I found this idea which only depends on the command line utility svnversion
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 grabs the version in the ant property:
<exec executable="svnversion" outputproperty="svnversion" />
source to share
There are several ways -
Using a utility - I believe you are looking for this - https://code.google.com/p/svntask/ I have used it for some side projects and it works well.
Use a command line utility. - "svn info http://svn.myweb.com/myproject ". To use this method, simply create a batch file and place this command in the batch file. Then name this batch file from your ant task and get the version number from the text by searching that starts with the line "Revision:". Or you can simply upload the entire result.
source to share
Here is my option for combining SVN version information into an application artifact:
<target name="svn_revisions">
<exec dir="${basedir}" executable="svn" output="${dir.out}/.revisions">
<arg line="info"/>
</exec>
<exec dir="${basedir}" executable="svn" output="${dir.out}/.revisions" append="true">
<arg line="status -u"/>
</exec>
</target>
<target name="build-war" depends="compile, svn_revisions">
<war basedir="web" file="${dir.out}/ROOT.war" webxml="web/WEB-INF/web.xml">
<!-- main stuff -->
<zipfileset dir="${dir.out}" prefix="META-INF" includes=".revisions"/>
</war>
</target>
source to share