Ounce/Ant and Apache/Ant integration

The steps outlined in this task topic are necessary to integrate Ounce/Ant into the Apache/Ant build environment.

Procedure

  1. Copy the ounceant.jar file and, optionally, ant-contrib-1.0b3.jar to the ant lib directory.
    If Ant plugin version is 1.8.1 or newer, copy xml-api.jar and xercesImpl.jar as well.

    The AppScan® Source installation places ounceant.jar and ant-contrib-1.0b3.jar, xml-api.jar, and xercesImpl.jar in <install_dir>\lib (where <install_dir> is the location of your AppScan® Source installation).

  2. Optional: Override the build.compiler property.

    See Creating projects for more information about overriding build.compiler.)

    Override this property using one of the following methods:

    • Use a property tag in the build.xml file.
      <property name="build.compiler"
      value="com.ouncelabs.ounceant.OunceCompilerAdapter"/>
    • Specify the value for build.compiler on the command line when invoking Ant using the -D option.
      ant -Dbuild.compiler=
      com.ouncelabs.ounceant.OunceCompilerAdapter
    • Include the value for build.compiler in a text file and instruct Ant to load the properties in that file using the properties option as described in the Ant documentation.
  3. Create taskdefs.

    To use Ounce/Ant tasks, you must reference ounceant.jar in a taskdef task. For example,

    <taskdef resource="com/ouncelabs/ounceant/task/ounce.xml"
    classpath="ounceant.jar"/>

    To use the var task, ant-contrib-1.0b3.jar must reference the taskdef task as follows:

    <taskdef resource="net/sf/antcontrib/antlib.xml"/>