Using Ant scripts to generate UML model reports

You can use Apache Ant scripts to generate UML model reports. You can set the scripts to generate the reports automatically when you make changes to the models.

Apache Ant is an open-source, Java-based build tool. You can 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.

These instructions are for using Ant build files to generate reports for models from within the workbench. For more information about the Ant build tool, see the Apache Ant Web site and the workbench overview topics.

The Ant script element that handles report generation is the custom element com.ibm.ccl.erf.rsa.report.ic.ant.UMLBirtReportPublish. A script can contain more than one of these elements if you need it to generate multiple reports.

To generate a report by using an Ant script:

  1. In the Project Explorer view, in a project, create a new file with an XML extension.
  2. Set the Ant editor as the default editor for this file:
    1. Click Window > Preferences.
    2. Expand General, expand Editors, and then click File Associations.
    3. To the right of the File types list, click Add, type a name for the XML file, and click OK.
    4. From the File types list, select the XML file.
    5. From the Associated editors list, select Ant Editor, click Default, and click OK. If the Ant Editor is not in the list, click Add to add it.
    6. If the XML file is open, close it; then double-click the file to open it in the default Ant editor.
  3. In the XML file, type <pr and, in the element completion window, double-click the <project> element.
  4. Assign a default target in the <project> element; for example, <project default="MyTarget">.
  5. Between the opening and closing<project> element tags, create a target; for example, <project default="MyTarget"><target name="MyTarget"></target></project>.
  6. Between the opening and closing<target> element tags, type <pu and select PublishUMLBIRTReport from the completion list. This adds the UMLBirtReportPublish element to your Ant script.
  7. Specify values for the task parameters, and click File > Save.
    Note: For syntax information, see the topic "Ant syntax for report generation with BIRT report designs."
    The script should look similar to this example:
    <project default="MyTarget"><target name="MyTarget">
          <com.ibm.ccl.erf.rsa.report.ic.ant.UMLBirtReportPublish 
             modelPath="C:\workspace\MyModel.emx" 
             targetOutputFolder="c:\temp\pubweb" 
             targetOutputFile="MyReport.html" 
             reportDesignFile="file:/C:/<product location>/plugins/com.ibm.ccl.erf.rsa.report.data/designs/modelSummary.rptdesign" 
             overwriteExisting="true" 
             autoShowPublishedOutput="true" 
             errorHandling="ignore" 
             outputType="html"
             transform=""/>
    </target></project>
  8. In the Project Explorer view, right-click the XML file and then click Run As > Ant Build .... Be sure to click Ant Build ..., and not Ant Build.
  9. On the JRE page of the dialog box, under Runtime JRE, click Run in the same JRE as workspace.
  10. To run the script and generate the report, click Apply and then Run.
You can also set the Ant script as a build file that runs automatically whenever a model is modified. For more information, work through the tutorial named "Automate publishing and reporting with Apache Ant."

To use Ant scripts to generate reports using an XSLT template, select PublishReport instead of PublishBIRTUMLReport from the completion list, and specify the values for the com.ibm.xtools.publish.CLLegacyXSLTReportPublish task. For syntax information, see the topic "Ant syntax for UML report generation with XSLT templates."


Feedback