Sunday, February 07, 2010

Cowley - A Hudson plugin for RTC (v.1.0.0) - Part 2 - IBM, meet Maven

Introduction
In my previous post, I introduced version 1.0.0 of Cowley, a Hudson plugin for IBM's Rational Team Concert (RTC) SCM system. I'd love for the plugin to be a simple one-click install like many others in the ecosystem, but unfortunately it currently relies on the RTC Build System Toolkit which is freely available, but isn't in any public Maven repositories. This means, in order to simply use the plugin, or to build it from source, you need to do a little Maven / Ant / Jar magic. This post in the series will tell you how.

Note: This post is specifically geared towards getting the required pieces of the Build Toolkit into a Maven-usable state. However, there is nothing here which couldn't be taken and reused in many other circumstances.

Pre-Requisites
I'm assuming for the rest of the instructions that you have Java 1.6 and Maven 2.x installed. If not, why not? Get to it!

Obtaining the RTC Build System Toolkit
Job 1 is to get the Jazz RTC Build System Toolkit. You can download it from jazz.net (Windows) (Linux) (registration required).

NOTE: The rest of the instructions are based on the Windows version of the toolkit. I guess, as its all Java based, it's really similar. Post comments on this blog if there is additional info I need to add here.

Once you have the Build System Toolkit downloaded, unzip it somewhere temporary.

The Maven / Ant / Jar Magic
Next you need to get all the jars which come with the IBM Toolkit, wrap them up as a single jar, and add it to Maven for quick access and reuse. To do this, you'll need the following maven pom.xml. Cut and paste it into a file for use.

Now if you create a directory, put this new pom.xml file into it, edit the property "rtc.build.toolkit.plugins.dir" property and run the "mvn install" command. This will get the maven plugins and dependencies required, create your uber-jar, and "install" (i.e. copy) it into your local maven repository.

Congratulations!
You now have the required elements of the RTC Build Toolkit installed in maven, ready to either be added direct to your Hudson install to enable your Cowley plugin, or so you can compile my RTC Proxy API from source.

Either way, look out for the later posts in this series to find out how to obtain and use the Cowley Plugin without looking at any more code, as well as the gory details of the plugin development (if you're feeling sadistic).