Exercise 3: Populating the Ant script

This exercise shows you how to edit the Apache Ant script to publish a web and to publish a report.

Before you begin, you must complete Exercise 2: Creating and configuring the Ant script.

Adding a publishing a web element to the Ant script

To add the elements to publish in your Ant script, follow these steps.
  1. In the Model Explorer or Navigator view, double-click your publish.xml Ant script.
  2. In the Ant editor window, type <pr Ctrl+Space to add the <project> element. The element completion window pops up with <project> element. Enter a name in the default attribute. An example is <project default="foo"></project>
  3. Position the cursor before the closing </project> tag and type <ta Ctrl+Space to add the <target> tag
  4. From the list of possible elements, double-click <target>. Enter a name for the Name attribute. An example is <target name="foo"> </target>
  5. Position the cursor before the closing </target> tag and type <pub Ctrl+Space to add the <target> tag
  6. From the list of possible elements, double-click <PublishModel>.
  7. Enter the fully qualified path name to the SimpleUMLModel as the value of the modelPath attribute. To see the path name, select the model in the Model Explorer or Navigator and right-click Properties. Cut and paste the value of Location and then click Cancel in the Properties dialog box.
  8. Move your cursor to anywhere over "fully_qualified_path_to_the_output_folder", double-click and enter the fully qualified path name of the output folder in the outputFolder attribute.
    Note: The folder needs to exist.
    For example, enter c:\pub\web.
  9. Leave the other attributes to use their default values.

Adding a publishing report element to the Ant script

To add the elements to publish in your Ant script, follow these steps.
  1. Position the cursor before the closing </target> tag and type <pub Ctrl+Space to add the <target> tag
  2. From the list of possible elements, double-click <PublishReport>.
  3. Enter the fully qualified path name to the SimpleUMLModel as the value of the modelPath attribute. To see the path name, select the model in the Model Explorer and right-click Properties. Cut and paste the value of Location and then click Cancel in the Properties dialog box. An example is C:\Documents and Settings\user1\ws1\SimpleUMLProject\SimpleUMLModel.emx.
  4. Move your cursor to anywhere over "fully_qualified_path_to_the_output_folder", double-click and enter the fully qualified path name of the output folder in the outputFolder attribute.
    Note: The folder needs to exist.
    For example, enter c:\pub\rpt.
  5. Move your cursor to anywhere over "file_name_to_use", double-click and enter the "Sample UML Metrics Report" report name in the ReportName attribute.
  6. Leave the other attributes to use their default values.
  7. Click File > Save to save the file.
You Ant script should now contain the following elements (Note that your attribute values may be different):
<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>

Now you are ready to begin Exercise 4: Testing and setting up automatic execution of the Ant script.

Feedback
(C) Copyright IBM Corporation 2005. All Rights Reserved.