Ant has a somewhat limited built-in Subversion task. An alternative if you need more power (and I can’t quite remember why I did, but I did) is Subclipse’s ant task – but setting it up isn’t so obvious, especially if you don’t use Subclipse as your main Subversion plugin.
The Ant task provides a Java wrapper around two different ways to access Subversion: either a command line ‘svn’ command, or the JavaHL DLL. Initially I opted for the former (using this Windows client) which appeared to work passably well, but generated reams of logging that slowed commits to a crawl; the Ant task didn’t allow you to pass additional command line parameters on to the command, so there wasn’t much that could be done about it.
An obscure bug, probably something to do with a slightly corrupted Subversion project in our repository, finally led me to reassess today, and after an afternoon of fun I scrapped the Windows client and went after the DLL.
To get it (and for some reason it took me a while to think of this), download the latest ‘update site’ zip for the latest Subclipse Eclipse plugin (currently 1.6.2), open it and pull out the four jar files with names starting
org.tigris.subversion.clientadapter. Note: don’t be distracted by the Update URL, which is the conventional way to actually install the plugin.
Drop these four jars in some suitable lib folder, and make sure they are added to Ant’s runtime classpath – in Eclipse, you do it from the Window > Preferences dialogue under Ant > Runtime:
You can add them to the Ant Home or Global sections, it works either way.
Our entire automated tagging system now runs vastly quicker without the logging, and so far has been bug free even where the Windows client was balking about some off metadata thing (which is the only thing it didn’t adequately log, so no easy way to fix it). Excellent.