ColdFusion, Ant and Subversion = AntFarm Build Manager

I have beeen working on a little ColdFusion application at work that will allow us to quickly create builds of our applications and move them to the dev/staging server for us to prepare for testing by our QA team. I have to admit I put off learning Ant for a long time but now I am SO glad that I did.

I got started playing with Ant based on a suggestion from Sean Corfield. I was asking Sean if there were any ways to checkout a copy of the latest code from Subversion and copy it to our dev server without having to do it manually and he quickly pointed me to Ant.

So this little application Im calling AntFarm houses configurations of all of our projects and allows you to quickly create builds and deploy them. Its actually coming in quite handy since we have multiple developers all contributing to the same projects in subversion. Here are the features so far:

  • Holds configs for multiple projects
  • Checks code out from your subverion repository based on the project
  • Cleans up the code removing and unwanted files like .project files that somehow always find their way into subversion
  • Dynamically creates the version for the project and appends the subversion revision number to the build
  • Creates a tag in your subversion repository named with the appropriate version
  • Deploys the code to your deployment path (currently only works on local and mapped directories)
  • The project list shows you the latest build version and allows you to open the ant log for that build.
  • Allows use of your own custom build files or use the prepackaged one
Thats about all I can think of for now. Im really wanting to release this as opensource for everyone to modify as they see fit but I have to make sure that my boss doesnt mind since some of it was written on company time. Im sure he will be ok with it.

Its written on CF7 using Fusebox 5 so you will need to install the Fusebox framework as well as the latest version of ant in order to run it.

Heres a little snippet from the build.xml file that I will include with AntFarm. This gets the revision of the checked out code and then writes that to a file. Then I use the REPLACE task to replace that revision number with the full buildversion property. Its really quite nat!

<!-- set some properties -->
<property name="project.name" value="MyProject" />
<property name="project.outputDir" value="d:\wwwroot\antfarm\version\"/>
<property name="project.versionFile" value="${project.name}.cfm"/>

<!-- Get the revision of our checked out code and output it to a file -->
<exec executable="svnversion" dir="${project.buildRoot}" spawn="false" output="${project.outputDir}${project.versionFile}">
<arg line="."/>
</exec>

<!-- Build the full version number -->
<property name="buildVersion" value="${baseVersion}_b${revision}"/>
      
<!-- Replace the version in the file with the full build number -->
<replace file="${project.versionFile}" token="${revision}" value="${buildVersion}"/>

And thats really all there is to that. I will post somemore tomorrow once I make sure its ok to release it.


Related Blog Entries

Feel free to Leave a Comment or just read what others have to say

1 Comments (Comment Moderation is enabled. Your comment will not appear until approved.) so far

  1. Gman 8/6/07 9:19 AM
    Gman's Gravatar Russ,
    I have a great need for this at work as well. We have the same standard setup. Dev on local, staging server and production server.
    Would be nice if you could include a litte more info to get a person up and running. Could you please include or send me the SQL script
    for MS SQL. At the very least,the column names and datatypes. The download at RIAforge has no sql script or db info.
    Would be greatly appreciated.

    Thanks
    Gman