ANT SVN update project script

We now have a solution to update each of our customer sites on our devserver. We installed ANT on the server to the default directories and then called the undocumented cfant tag via ColdFusion.

Installing the necessary files to get the SVN task working isnt hard, you simply download and drop these files into the /lib directory under ANT home. In our case thats C:\Program Files\apache-ant-1.7.1\lib

svnant.jar svnjavahl.jar svnClientAdapter.jar svnkit.jar ganymed.jar

You can lay your hands on all these files at SVNAnt

First, the build.properties file contains one line:

svn.dev.wc=c:/path/to/client/site.local/
Then here is the ANT script to make short work of an SVN update:
<!--
   Properties to be set by SVN
   $ID$
   $REV$
-->

<project name="SVN Update" default="update" basedir=".">
   <description>
      Updates to head revision
   </description>
   
   <!-- all properties are in build.properties -->
   <property file="build.properties" />
   
   <!-- path to the svnant libraries. Usually they will be located in ANT_HOME/lib -->
   <path id="svnant.classpath">
      <fileset dir="${ant.home}">
         <include name="**/*.jar"/>
      </fileset>
   </path>
   
   <!-- load the svn task -->
   <typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="svnant.classpath" />
   
   <target name="updateserver">
      
      <echo message="Automatic updater" />
      
      <property name="svn.username" value="xxxxx" />
      <property name="svn.password" value="xxxxx" />
      
      <!-- update working copy to make sure -->
      <echo message="updating working copy at ${svn.dev.wc}" />
      
      <svn username="${svn.username}" password="${svn.password}">
               
         <update dir="${svn.dev.wc}"/>
      
      </svn>
      
   </target>
         
</project>

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
BlogCFC was created by Raymond Camden. This blog is running version 5.9.001.