< Previous | Next >

Lesson 7: Set up the Ant script to run automatically

This lesson shows you how to set up the Ant script so that it runs automatically every time the project changes.

To set up the Ant script to run automatically:

  1. In the Project Explorer view, right-click the AntTutorial project and then click Properties.
  2. In the Properties for AntTutorial window, on the left, click Builders.
  3. To the right of the Builders pane, click New to create a new builder.
  4. In the Choose configuration type window, click Ant Build and click OK.
  5. In the Properties for New_Builder window, type publish_builder in the Name field.
  6. For the Buildfile field, click Browse Workspace; then select publish.xml and click OK.
  7. Click the JRE tab and verify that Run in the same JRE as workspace is selected.
  8. Click the Targets tab. This page lists project events and the targets that they are set to trigger. Here, note that a "Clean" operation for the AntTutorial project will trigger the default target, MyTarget. This will publish the model and generate the report.
  9. Click Apply and then OK.
  10. Click OK in the Properties for AntTutorial window.
  11. To test automatic publication, click Project > Clean. In the Clean window, select Clean projects selected below; then select AntTutorial and click OK.
  12. Navigate to the output in Windows Explorer and verify that new versions of the published model and the report have been generated.

The publish.xml Ant script will now be executed automatically whenever any of the events specified in the Targets pane of the Properties window occurs.

< Previous | Next >

Feedback