Appendix B

Running itag-build.xml inside Eclipse

It is possible to set up Eclipse to allow you to run itag-build.xml locally.  This is helpful for quick prototyping and iterative debugging before using the ITAG release scripts on the build server.  It can be a huge time saver in the overall process.

Step 1

Add an <import file=”${}”> tag to your itag-build.xml file pointing to a location on your local machine.  The name and location of the file are not important so long as the file is not checked-in to your project.  Important:  This must point to a file that is not included in your project and the ‘optional’ attribute must be set to ‘true’.    In the example below the file was set in the user’s home directory.  When the ‘optional’ flag is true Ant will process the file if it exists, but if it doesn’t, it won’t throw an error.  This means if itag-build.xml is run locally and the file exists it will use it and when it’s run on the build server and doesn’t exist it will just ignore the tag.

itag-build.xml (snippet)

<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: itag-build.xml 1121 2011-06-15 19:58:43Z devdss $ -->
<project name="itag-build-integration" default="usage" basedir=".">
       <property name="build.dir" value="${basedir}/build"/>
       <property name="src.dir"   value="${basedir}/src"/>
       <property name="root.dir"  value="${basedir}/root"/>
       <property name="docs.dir"  value="${basedir}/docs"/>
       <property name="bpel.dir"  value="${docs.dir}/bpel-resources"/>
       <property file="${basedir}/build.properties"/>
       <property name="src.jar"   value="${build.dir}/${webapp.name}.src.jar"/>
       <import file="${user.home}/.itag/itag-local-build.xml" optional="true"/>

Step 2

Here’s the real trick. Create a simple Ant build file locally and save it to the file the tag is pointing to. Inside this simple build file define the variables that the ITAG release script provides when running on the build server, namely ‘itag.platform.path’ and ‘itag.out.dir’. Make sure these variables point to the correct locations on your local machine. Now if you run itag-build.xml locally it will find your local file and use the values defined in there. When it is run on the build server by the ITAG release scripts it will not find the file and it will then use the values defined by the ITAG release scripts.

itag-local-build.xml (example)

<?xml version="1.0" encoding="UTF-8"?>
<project name="itag-local-build-integration" basedir=".">
 
  <!-- ITAG platform libs used for testing -->
  <path id="itag.platform.path">        
    <fileset dir="c:/itag/lib">
      <include name="**/*.jar"/>
    </fileset>
  </path>
 
  <!-- ITAG out directory used for testing -->
  <property name="itag.out.dir"      value="${build.dir}/out"/>
 
</project>

Once this is done you can use Eclipse’s Ant launcher to invoke the ‘itag.build’ target of your ‘itag-build.xml’ file and it will build all of your deployable components. Of course, it won’t deploy them for you, it will just build them.