Exercise 2: Creating and configuring the Ant script

This exercise shows you how to create the Apache Ant script and how to configure the system to use the Ant editor to edit the file.

Before you begin, you must complete Exercise 1: Importing the model.

Creating the Ant script

To create the Ant script in the SimpleUMLProject project, follow these steps.
  1. In the Model Explorer view, select the SimpleUMLProject project and right-click New > File.
  2. In the New File dialog box, type the name of Ant script, publish.xml, in the File name field.
  3. Click Finish. The file publish.xml is added to your project.
  4. Optional: If your file is not visible in the Model Explorer, open the Navigator view by completing the following steps:
    1. Click Window > Show View > Other....
    2. In the Show View window, expand Basic, select Navigator and click OK. The Navigator view opens with the SimpleUMLProject project.
    3. Expand the SimpleUMLProject to see the publish.xml file.

Setting up to use the Ant editor

The Ant editor includes the following features:
  • Syntax highlighting.
  • Content/code assist (including Ant specific templates).
  • Annotations.
More information on the Ant editor can be find in the online help under Eclipse Ant basics.

To automatically use the Ant editor when you open your Ant script, follow these steps.

  1. Click Window > Preferences.
  2. In the Preferences window, expand the Workbench item in the left and click File Associations.
  3. If the File types list does not include publish.xml, follow these steps:
    1. In the File types pane, click Add.
    2. In the New File Type dialog box, type publish.xml and click OK.
  4. In the File Associations pane, scroll to and select your Ant script, publish.xml, in the File types field.
  5. If the Associated editors list does not include Ant Editor, follow these steps:
    1. In the Associated editors pane, click Add.
    2. In the Editor Selection dialog box, select the Ant Editor and click OK.
  6. In the Associated editors field, click Ant Editor and click OK.
  7. If the Ant icon is not visible to the left of your publish.xml file, close the window and, open the Navigator view by completing the following steps:
    1. Click Window > Show View > Other....
    2. In the Show View window, expand Basic, select Navigator and click OK. The Navigator view opens with the SimpleUMLProject project.
    3. Expand the SimpleUMLProject to see the publish.xml file.

Now you are ready to begin Exercise 3: Populating the Ant script.

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