Coding

Getting Subversion Revision in Ant


[tweetmeme source=”gosub3000”]
Here’s a nifty Ant snippet. This can be used to get the Subversion revision number from your Ant build system. Using this, you can label your build artefacts, providing better visibility on what exactly is contained in each build.

<target name="find_revision" description="Sets property 'revision.number' to the head svn revision">
        <property name="revision" value="HEAD"/>

        <!-- find out revision number of HEAD, need svn.exe installed on local machine -->
        <exec executable="svn" outputproperty="svnlog.out">
            <arg line="log ${homedir}/.. -r ${revision} -q"/>
        </exec>

        <echo>${svnlog.out}</echo>

        <!-- need ant-contrib.jar for this in lib dir of ant install -->
        <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
        <propertyregex property="revision.number" input="${svnlog.out}" select="\1">
            <regexp pattern="r([0-9]*)"/>
        </propertyregex>

        <echo>Revision found: ${revision.number}</echo>
    </target>
Standard
Coding

Transaction Management for JPox with Spring.


[tweetmeme source=”gosub3000”]
I was on the edge of writing some unkind things about JPox and Spring this week, as I dealt with the frustration of getting Spring to manage transactions for the JPox persistence code I was writing.

The issue I was dealing with, was the persistence of a org.springframework.orm.jdo.JdoUsageException. I decided to simplify, and I downloaded the JPox JDO Tutorial, and decided to reimplement it using Spring.

Read on for the cause, and solution to my problem. Continue reading

Standard