How to get the SVN revision number for use in ANT

As part of my build and deploy process I wanted to get the revision number of the working copy and append it into the application so its visible. To do this you need to have already installed the SVNAnt task, (see my previous post) as its not a core ANT task. Using the status task, […]
Last updated: March 12, 2012

As part of my build and deploy process I wanted to get the revision number of the working copy and append it into the application so its visible. To do this you need to have already installed the SVNAnt task, (see my previous post) as its not a core ANT task.

Using the status task, we can pull out all of the properties of a file or directory, here I have chosen to use my application.cfm as its always present in a ColdFusion application.

Notice how we use the revisionProperty attribute to enter the variable we need, svn then applies the revision number to that variable for later use. Note that for this example my build.xml is local to the webroot and the application.cfm. This clearly isnt best practice, and I will comment later on this matter.

Duncan Isaksen-Loxton

Educated as a web developer, with over 20 years of internet based work and experience, Duncan is a Google Workspace Certified Collaboration Engineer and a WordPress expert.
Login
Log in below to access your courses.
Log In With Google
Forgot Password
Enter your email address or username and we’ll send you instructions to reset your password.