Publishing with Ant scripts

You can use Apache Ant scripts to initiate the publishing of webs and reports.

Apache Ant is an open-source, Java-based build tool. The Eclipse support for Ant allows you to create and run Ant build files from the Workbench. The Ant build files can operate on resources in the file system as well as resources in the workspace. For more information about the Ant build tool, see the Apache Ant Web site and the Workbench overview topics.

To publish to a web, your Ant file needs to contain a CLModelPublish element. To publish a report, it must include the CLModelReport element. Your Ant file can contain more than one publish element. If you are using the Ant Editor, type the start of an element and Ctrl-Spacebar for content assistance.

To publish using an Ant script:

Add the CLModelPublish or the CLModelReport element to your Ant script. The following Ant script publishes a model to a web and a report:
<project default="foo">
  <target name="foo">
<!-- ===================================================================
      modelPath: required parameter, fully qualified path(FQP) to the model to publish
      outputFolder: required parameter fully qualified path(FQP) to folder to publish to
     =================================================================== -->

    <com.ibm.xtools.publish.CLModelPublish
      modelPath="C:\Documents and Settings\user1\ws1\SimpleUMLProject\SimpleUMLModel.emx"
      outputFolder="C:\myWebs\FooWeb"
      overwriteExisting="true"
      preview="false"
      showIcons="true"
      diagramImageFormat="gif"
      detailLevel="full"
      errorHandling="ignore"/>

<!-- ===================================================================
      modelPath: required parameter, fully qualified path(FQP) to the model to publish
      targetOutputFolder: required parameter, fully qualified path(FQP) to folder to publish to
      targetOutputFile: required parameter, file name of the report
      =================================================================== -->
    <com.ibm.xtools.publish.CLReportPublish
      modelPath="C:\Documents and Settings\user1\ws1\SimpleUMLProject\SimpleUMLModel.emx"
      targetOutputFolder="c:\myRpts\simpleRpt"
      targetOutputFile="metric.pdf"
      reportName="Sample UML Metric Report"
      overwriteExisting="true"
      autoShowPublishedOutput="false"
      errorHandling="ignore"/>  
  </target>
</project>
Note: The modelPath parameter can contain more than one model, separated by a semi-colon, such as "c:\foo\mymodela.emx;c\bar\mymodelb.emx".
The Ant script will publish a web of HTML files and a report when it is run. The Ant file can also be set as a build file to run automatically whenever a model is modified.

Related information

Apache Ant Web site

Terms of use | Feedback
(C) Copyright IBM Corporation 2004, 2005. All Rights Reserved.