This article is a tutorial taking the user through the steps necessary to create and run an Ant script for Windchill. Ant is a very useful tool to build source, but with some basic techniques shown here it can also be used to script a number of actions related to a administration of the customization. A typical usage would be installation of a PDMLink™ or ProjectLink™ customization where the ant script will need to add files, update XML files and compile resource bundles. A major advantage from using simple batch or shell files is that ,as Ant is platform independent, we can develop on Windows and and deploy using the same scripts on Unix.

  • Running Ant in Windchill
  • Setting up basic parameters
  • Updating a Windchill property
  • Compiling a resource bundle

Running Ant in Windchill

Ant is pre-installed in all Windchill Installations, so we do not need to install anything. Ant can be executed from a Windchill shell as follows

ant -f [script]

In addition a very useful library is also pre-installed called ant-contrib which adds features, such as if-then-else, these allows us to use Ant outside it’s normal domain of managing the build process.

Setting up basic parameters

In order to setup our Ant script we often need to have various parameters available, some of which are OS dependent. So for this we can use a setup task

<target name="setup">
    <echo message="Setting up environment"/>

    <!-- The Windchill home & codebase taken from the env -->
    <property environment="env"/>
    <property name="wcinstall" value="${env.WT_HOME}"/>
    <property name="codebase" value="${wcinstall}/codebase"/>

    <!-- The O/S dependent xconf command  -->
    <condition property="xconfCommand"
               value="${wcinstall}/bin/xconfmanager.bat" >
        <os family="windows"/>
    <property name="xconfCommand"

    <!-- The O/S dependent ant command  -->
    <condition property="antcmd" value="ant.bat" >
                   <os family="windows"/>
    <property name="antcmd" value="ant" />

    <!-- Custom task for updating XML with XPath -->
    <taskdef name="xmltask"
             classname="com.oopsconsultancy.xmltask.ant.XmlTask" />

    <!-- ant-contrib to allow us to use if-then-else  -->
    <taskdef resource="net/sf/antcontrib/"/>


Updating a Windchill property

Windchill has a standard technique to update it’s many property files such as This is controlled by a master file called site.xconf that looks as follows

<Configuration xmlns:xlink="">
   <Property name="installedProduct.location.Apache" overridable="true"
   <Property name="" overridable="true"



You can update it as follows using the xconfmanager command

<target name="addlistener" depends="setup">
    <echo message="Adding listener"/>
    <exec executable="${xconfCommand}">
    <arg value="-tcodebase/"/>
    <arg value="-p"/>
    <arg value="-s" />

Note the the dependency to setup

Compiling a resource bundle

<target name="resourcebuild" depends="setup">
<echo message="Building resource bundles"/>
<exec executable="${wcinstall}/ant/bin/${antcmd}">
    <arg value="-f"/>
    <arg value="${wcinstall}/bin/tools.xml"/>
    <arg value="bundle"/>
    <arg value="-Dbundle.input=ext.myclient.MyClientRB"/>
    <arg value="-Dbundle.buildLocales=true"/>
     <delete file="${codebase}/"/>

To be continued… please add a comment if you are interested