The amazing adventures of Doug Hughes

In my continuing quest into all that is good with Ant, one of my tasks was to interface with our Subversion repository in order to export the latest code base, possibly tag it, al before shipping it off to the testing or production server.  In looking around, there are several ways to doing this – some that are limited to use within Eclipse, some that require third party downloads, and several others that were not documented well enough to know what they did.  In the end, I chose to use SVNAnt and configure things in a manner that I could run the build file from within Eclipse or from the command line if the need arose.

What is SVNAnt?

According to the documentation, SVNAnt "… is an ant task that provides an interface to Subversion revision control systems …"  Once SVNAnt is configured in your Ant build file, you can do almost anything via your build file that you could do using a Subversion client.  There are a few commands that are not supported, but there are 23 that are including the most common add, commit, export, etc. commands that you typically use.

You can download SVNAnt from  The current release at this point is 1.0.0 which is available via a zip file.  In all of my incantations trying different things, I actually pulled the latest release from the SVN repository and compiled it to give me a 1.1.0 release.  This is the release I will be setting up below.

Setting it Up

  1. Download the latest release of SVNAnt from the SVN repository at:
  2. Next, go to the folder in which you downloaded SVNAnt and copy the file to  Uncomment all of the property lines and then add a single line at the bottom with the following text.

    targetJvm = 1.6

    In my case, I am running JVM 1.6.X with ColdFusion 8.  If you are running a lower JVM, adjust this number to match your JVM.  Then, save the file.

  3. Next, assuming you already have Ant installed (see if not ), at the command line move to the folder where you downloaded SVNAnt above and type:

    ant makeDistrib

    You should get a bunch of stuff displayed with the last thing being a build successful message.   You should now have version 1.1.0 compiled and ready to go.

  4. Now, inside of your SVNAnt folder should be a folder called build, in which should reside a zip file named  If you open up that zip file, in it should be a folder called lib, in which should be a collection of jar files.  These are the important ones that we need.  Extract / copy all of these files to the lib folder under your Ant installation.  In my case, I am using the Ant installation that comes as part of Eclipse, so I copied the files to:


With that complete, SVNAnt should be setup and we are ready to start writing build files.

A Test Build

I am not going to get into how to write a build file here, but lets at least create one that will test our SVNAnt installation.  Create a file called build.xml somewhere in your file system and put the following XML in it.

<project name="test" default="svn.test" basedir=".">
     <path id="svnant.classpath"  >
            <include name="*.jar" />

    <typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="svnant.classpath" />

    <target name="svn.test">
            <wcVersion path=" [ PATH TO CHECKED OUT SVNANT WORKING COPY ] " />
        <echo message= "Subversion repository url: ${repository.url}" />

Lets break this down to see what is happening here.  The path tag tells the build file where to find SVNAnt.  The only thing you will need to change here is the path to the Ant lib folder where you put the SVNAnt jar files.  Note: for windows, the path needs to contain forward double slashes, so "c:eclipse" would be "c:eclipse".

After the path tag, is the typedef tag.  The typedef tag defines the svn type so that we can use it later on.  Everything here should work as is with no changes.

Last we get to our target.  The target is the portion of the build file that will execute the various tasks you want.  In this case, we are doing a simple wcVersion SVN command to get some information about a subversion repository.  If you replace the contents of the path attribute with the file path to the working copy of the SVNAnt repository you checked out earlier, you should be able to run the build file.  Again, note for windows, the path needs to contain forward double slashes, so "c:eclipse" would be "c:eclipse".

Now, if you run this within Eclipse or run it from the command line, you should get back a nice little Build Successful message.  You now have the ability to perform Subversion operations from Ant and make your deployment process so much easier.

Learn More

To learn more about the commands that are available via SVNAnt, check out the documentation page for SVNAnt at

Comments on: "Ant + Subversion (on Windows)" (10)

  1. Rob Wilkerson said:

    Did you have trouble installing SvnAnt or was this more of an academic exercise? I’ve been using SvnAnt for a couple of years now and have never had a problem getting it installed. Is this something I have to look forward to if/when I upgrade?


  2. Jeff Chastain said:

    Rob – The instructions above obviously are not that difficult. Where I had the hardest time was finding information online. It seemed every example or article I found was missing a few steps and I had the hardest time finding the right place for the right jar files and getting the paths correct.

    Hopefully others can benefit from this and it will be a lot easier than what I went through.


  3. Rob Wilkerson said:

    Nah, they’re not that hard, but as I mentioned somewhere else this morning, I find that the older I get, the less time I want to spend monkeying around installing something I just want to use. 🙂

    I had just never had to go to any “extraordinary” lengths to install SvnAnt, so it got me wondering whether I was missing out on something cool or whether I was going to run into problems later.

    Thanks for clarifying.


  4. if I want to fetch only incremental revisioned files what command is suitable?
    I also want to see newly fomed classes after compilation.


  5. First time installing svnant, and this covered everything needed (the instructions were missing from other the reminder about the double slashes was invaluable). Thanks!


  6. Thank you for taking care in pointing out details like targetJvm and double slashes.

    Hope your page shows up on the top in Google search for svnAnt. It would save a lot of grief and time for new developers trying to install svnAnt. 🙂


  7. Ben Davies said:

    Hi Jeff,

    I didn’t know that there was a 1.1 version available. I tried your link to the svn repository above but it requested login details so I guess anonymous access is not allowed.

    Was this the case when you tried to download the source? If so, how did you get access?

    Do you have any idea whether getting the 1.1 release is worthwhile, or what the differences are to 1.0 (for which the binaries are available?).

    Or any ideas who a good contact would be? The svnAnt project itself seems pretty dev.

    Thanks for your help – I’m trying to automate my CF deployments and testing.



  8. Ben Davies said:

    OK, I’ve sorted out access to the subversion repository for anyone else’s reference. There is anonymous access, just use the ‘guest’ username and no password.


  9. hi i am using svnant1.2.1 and ant1.7.1 i tried to copy from one url to other url but it gives the error:
    Action: Check the spelling.
    Action: Check that any custom tasks/types have been declared.
    Action: Check that any / declarations have taken place.

    i want to tag from ulr to url
    how can i do this.
    please help….
    thanks in advance…


  10. Rather interesting blog you’ve got here. Thanks for it. I like such themes and everything that is connected to this matter. I would like to read a bit more soon.

    Best wishes


Comments are closed.

Tag Cloud

%d bloggers like this: