As I have mentioned in a previous blog entry, I have come to love using ANT in my development environment. One of the things that I like about it is how well it integrates with my Subversion repository using SVNAnt. If you are not using either ANT or Subversion, you owe it to yourself and your team to check it out.
Here we'll go over a simple build script that exports application files from the Subversion repository into a local folder in the CFEclipse project. You can then view the following entry on how to ftp that into your production/staging server.
First we need to make sure that your ANT install has the necessary SVNAnt jar files. You can download them here: http://subclipse.tigris.org/svnant.html. Once you unpack the svnant-1.0.0.zip file, you'll find threee jar files: svnant.jar, svnClientAdapter.jar, svnjavahl.jar. Place them on your [ANTInstall]/lib* folder.
Once you have the jar files in place, you can define them in your build file's property section like so:
<property name="svnant.lib" value="lib" />
<property name="svnant.jar" value="${svnant.lib}/svnant.jar" />
<property name="svnClientAdapter.jar" value="${svnant.lib}/svnClientAdapter.jar" />
<property name="svnjavahl.jar" value="${svnant.lib}/svnjavahl.jar" />
Followed by this path definition after all your properties have been defined:
<path id="project.classpath">
<pathelement location="${svnjavahl.jar}" />
<pathelement location="${svnant.jar}" />
<pathelement location="${svnClientAdapter.jar}" />
</path>
Now all you have left to do is add the following task definition:
<taskdef resource="svntask.properties" classpathref="project.classpath"/>
Now you are all set! You can now call
<!-- svn repo url -->
<property name="svn.url" value="http://[mysvnhost]/svn/repo/myprojectFiles/" />
<property name="svn.exportPath" value="[yourDirectory]:\\[pathToYourCFEclipseProject\\build" />
<target name="svn.export">
<echo message="Exporting application files from svn repository:" />
<input message="Please enter svn repo username:" addproperty="svn.username" />
<input message="Please enter svn repo password:" addproperty="svn.password" />
<mkdir dir="${svn.destPath}" />
<svn username="${svn.username}" password="${svn.password}">
<export srcUrl="${svn.url}" destPath="${svn.exportPath}" revision="HEAD" />
</svn>
<echo message=" ... finished exporting files." />
</target>
That's it. No more running command line tasks to get your subversion commands. For additional info and other SVN tasks you can go to http://subclipse.tigris.org/svnant/svn.html.

Phill Nacelli has been developing software for over 9 years, and have been using ColdFusion since version 4.5. He has engineered and developed multiple web based applications for the federal government, non-profit association/education market and enjoys playing with the latest in programming techniques, frameworks and development tools. He currently holds a position as Software Architect at




This is GREAT content! I will certainly bookmark this for later. Thanks a ton for making this and keep up the good work!
http://www.thecrumb.com/2007/02/07/using-ant-while...
I never liked that the Ant input task left the password exposed...
Very interesting! Thanks for the link. I'll be sure to check it out...
Cheers..
At the moment I'm working on an 'official' un-attended build process that automatically updates minor version numbers based on changed files in a directory (as determined by this SvnAnt library with a restriction on the username - we use the user 'build' to do automatic nightly builds which are flagged as 'official' as opposed to 'developer' builds).
All in all integration between ANT and whatever code repository system you use is beneficial - SvnAnt seems to provide a lot more useful information than any other that I have seen (and Subversion itself seems to be one of the more useful code repository tools available).
Cheers,
Ghost
PS: Seriously - your site is a good indication of why the Captcha mechanism sucks - when and where should I use capitals, what is the differentiantion between letters (eg O, o, i, I and numbers eg 1, 0). I have tried multiple times only to find out the first 'n' times are probably due to not providing an email address (which is not marked as compulsary - and the error message is not clearly indicated either). Now I'm getting 'Captcha' errors, but no indication of what I should input from the vague image that is displayed. Is it case sensitive? Are numerals expected and/or allowed? Who knows. Anyway - end of rant. I'll try again.
Cheers,
Ghost
Please clarify "Place them on your [SVNInstall]/lib* folder.".
What is [SVNInstall]/lib* folder? After installed Subversion, I see a folder "C:\Program Files\Subversion". Is this the SVNInstall folder? Under the "C:\Program Files\Subversion" folder, there is not "lib" folder
Basically the folder that you have ant running with Eclipse. If you are using Eclipse's default ANT install, it should be in the plugins folder of Eclipse (ie. C:\Program Files\Eclipse\plugins\org.apache.ant_1.6.5\lib).
Let me know if you have any more problems or questions.
Cheers...
I placed the 3 svn *.jars in C:\eclipse\plugins\org.apache.ant_1.6.5\lib. I don't know what else to check.
Here's a part of my build.xml:
<property name="svnant.lib" value="C:\eclipse\plugins\org.apache.ant_1.6.5\lib" />
<property name="svnant.jar" value="${svnant.lib}/svnant.jar" />
<property name="svnClientAdapter.jar" value="${svnant.lib}/svnClientAdapter.jar" />
<property name="svnjavahl.jar" value="${svnant.lib}/svnjavahl.jar" />
<path id="project.class.path" >
<pathelement path="${env.classpath}"/>
<fileset dir="${lib}">
<include name="**/*.jar"/>
</fileset>
<pathelement location="${src}"/>
<pathelement location="${build}"/>
<pathelement location="${svnjavahl.jar}" />
<pathelement location="${svnant.jar}" />
<pathelement location="${svnClientAdapter.jar}" />
</path>
<!-- load the svn task -->
<taskdef resource="svntask.properties" classpathref="project.class.path"/>
cheers
-Nags