Integrating IBM Rational ClearCase © and Apache Ant.
Description

This library is a collection of "value-add" Ant tasks for integrating IBM Rational ClearCase © with Apache Ant. The integration makes full use of the power and capabilities of Ant, with support for nested elements (such as filesets) and also supports conditions. There are a number of tasks for creating XML reports on both ClearCase baselines and labels as well as a task for "staging" ClearCase objects. For more information on the tasks that are available, click on the task names in the following table.

Tasks
Task Description
ccapply Interface between Ant and the ClearCase "cleartool" command with support for nested elements, as in the Ant <apply> task.
ccapplybl Applies a ClearCase baseline and promotes it if required; can be used either as a task or condition.
ccavailable Verifies the existence of a ClearCase object such as a branch or stream; can be used either as a task or condition.
ccblreport Reports on the contents of a ClearCase baseline and generates a formatted XML output.
ccdiffblreport Reports on the difference between ClearCase baselines and generates a formatted XML output.
ccdifflabelreport Reports on the difference between ClearCase labels and generates a formatted XML output.
ccexec Interface between Ant and the ClearCase "cleartool" command; as in the Ant <exec> task.
cclabelreport Reports on the contents of a ClearCase label and generates a formatted XML output.
cclscoselector Selector used to limit the files defined by that FileSet to those which are checked out of ClearCase.
ccstage Check-ins or "stages" a set of file system or ClearCase objects into a VOB location.
ccversion Retrieves the installed version and flavour of ClearCase; can be used either as a task or condition.
cqbuildrecord Creates a BTBuild record in ClearQuest. Requires ClearQuest V7.0
 
Installation and Use

The source and binary distributions can be downloaded from http://sourceforge.net/projects/clearantlib

You can either build the ClearCase antlib from the source or copy the pre-built jar file dist/clearantlib.jar into your current Apache Ant libraries directory. To automate the installation process you can execute the following on Windows:

    >set ANT_HOME=C:\apache-ant-1.6.5
    >ant install
or the following on Linux/Unix:
    >export ANT_HOME=/opt/apache-ant-1.6.5
    >ant install
changing the definition of ANT_HOME to where you have installed Apache Ant.

Once you have installed the antlib to use it in your Ant build scripts you need to reference its XML namespace as follows:
   <project name="test" default="main" xmlns:ca="antlib:net.sourceforge.clearantlib">
        <target name="main"> 	
            <ca:ccexec failonerror="true">
	        <arg value="checkout"/>
		<arg value="-nc"/>
                <arg value="foo.java"/>
	    </ca:ccexec>
        </target>
   </project>
For more examples see the individual tasks or this example Apache Ant build.xml file.
 
FAQ
  1. What is an antlib?
    An antlib is a prebuilt library that you can plug-in to Ant without re-compilation. An antlib is simply a set of classes referred to by an XML namespace and then referenced just as any other Ant task or type. This makes it easy for example to integrate a set of tasks with any prebuilt or bundled version of Apache Ant, for example the version included with Eclipse or Rational Application Developer.
    Note: you will need Ant 1.6 or greater for antlib support.

  2. Can I still use the existing ClearCase Ant tasks that come with the downloaded version of Ant?
    There is no reason why you can't use the existing ClearCase Ant tasks with this antlib, however bear in mind that as of Ant 1.6.1 there is nothing that you could do with existing ClearCase Ant tasks that you couldn't do with the <ccexec> or <ccapply> tasks that are included in this antlib.

  3. I have to enter a lot of text just to create simple ClearCase operations, can I have a task to do a ClearCase checkout, checkin...?
    The antlib has been kept deliberately high level. To use a task per ClearCase operation you can either use the existing ClearCase Ant tasks or create your own Ant macros.

  4. I am trying to run ccexec task using ant. I am getting the following error: taskdef A class needed by class net.sourceforge.clearantlib. CQBuildRecord cannot be found: com/ibm/rational/wvcm/stp/Repository.
    The CQBuildRecord task uses the Rational Team API. To allow this task to function, an early release of the API is now included (version 1.1.2 onwards) with the distribution. However you should install and use the latest version of the API from here where possible. You can copy the included .jar files to your Ant lib directory for a simple installation.

  5. I have found a bug, how do I raise a problem?
    To raise a bug, support request or feature request please use the forums at http://sourceforge.net/projects/clearantlib.


Copyright © 2000-2006, Kevin A. Lee; Portions © Apache Software Foundation