Sharing the Code

Programming stuff that might be useful to others

Using Subversion in Ant

I had a bit of a problem getting SVN to work within Ant in Eclipse on a Windows machine. SvnAnt can use Java JNI to connect to some SVN DLLs but I couldn’t find where to download the DLLs. It can also use the command line version of SVN. I found the latter simpler to setup.

  1. Download SvnAnt
  2. Unzip it to somewhere
  3. In Eclipse goto Window > Preferences > Ant > Runtime > Classpath Tab and add the SvnAnt jars to Contributed Entries. The SvnAnt jars are in the lib directory of the SvnAnt download
  4. Download and install a command line SVN client like Silk SVN
  5. Add the location of the SVN command line client to your PATH environment variable (by going to Control Panel > System > Advanced Tab > Environment Variables Button. Use a semi-colon to seperate it from the existing entry)

More info on the SVN Task.

Sample build.xml:

<project name="Sample" default="release">
    <property file="build.properties" />

    <taskdef resource="svntask.properties" />

    <target name="release">
        <svn username="${svn.username}" password="${svn.password}">
            <export srcPath="${src.dir}" destPath="${svn.export.dir}" />
        </svn>
    </target>

</project>

Comments are closed