Using ColdFusion with SVNkit and Subversion 1.7

ColdFusion , Default , Web Development Add comments

We recently had to update our post-commit hook functionality to be compatible with subversion 1.7 working copies.  There are more JAR file dependencies with 1.7, so here are some tips.

First, some explanation of what our setup is.  On commit of a new revision of a file, we trigger a ColdFusion script that does several things:

  • If the string @test is in the message, it updates the working copy of the application on our staging server.
  • If the string @live is in the message, it moves a copy of the file to our live server
  • If the string @cacheclear is in the message, it clears the trusted cache on the live server to force the new revision to go live immediately.
  • If the strong @p:<number> is in the message, it stores the details of the revision into a database that we use for tracking specific parts of our site (and writing automated launch scripts).
All of this functionality is run through a file called postcommit.cfm that is executed at each commit.

Until this week, the working copy on our staging server was using an older version of Subversion.  It was updated this week to 1.7 and our post-commit hook broke.  The main cause of the problem is that this script uses Java integration through the svnkit.jar library, which was an older version and did not support 1.7.

So, we downloaded the newest version with 1.7 support and started getting plenty of Java errors in the post-commits.  After a lot of experimenting and searching, it turns out that there are several jar files that are needed in addition to svnkit.jar to make the new version work.   The following additional jar files (also available at http://svnkit.com/) are needed in your class path:
  • sqljet-1.1.1.jar
  • antlr-runtime-3.4.jar
  • sequence-library-1.0.2.jar
With ColdFusion, you can either place these in an existing Java classpath on your server or you can use javaloader to load them when the script runs.  Here an example from a function in our script using javaloader:

<cfset var paths = ArrayNew(1)>
<cfset paths[1] = Replace(GetCurrentTemplatePath(), GetFileFromPath(GetCurrentTemplatePath()), "") & "svnkit-1.7.4-v1.jar">>
<cfset paths[2] = Replace(paths[1], "svnkit-1.7.4-v1.jar", "sqljet-1.1.1.jar")>
<cfset paths[3] = Replace(paths[1], "svnkit-1.7.4-v1.jar", "antlr-runtime-3.4.jar")>
<cfset paths[4] = Replace(paths[1], "svnkit-1.7.4-v1.jar", "sequence-library-1.0.2.jar")>
<cfset variables.javaLoader = CreateObject("component", "javaloaderv1.JavaLoader").init(paths, true)>

You can then run svn updates, get log messages, and perform all the standard subversion tasks from ColdFusion using the various methods in the svnkit objects.

 

0 responses to “Using ColdFusion with SVNkit and Subversion 1.7”

Leave a Reply

Leave this field empty:



Powered by Mango Blog. Design and Icons by N.Design Studio