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:
- In the Project Explorer view, right-click the AntTutorial project
and then click Properties.
- In the Properties for AntTutorial window,
on the left, click Builders.
- To the right of the Builders pane, click New to
create a new builder.
- In the Choose configuration type window, click Ant
Build and click OK.
- In the Properties for New_Builder window,
type publish_builder in the Name field.
- For the Buildfile field, click Browse
Workspace; then select publish.xml and click OK.
- Click the JRE tab and verify that Run
in the same JRE as workspace is selected.
- 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.
- Click Apply and then OK.
- Click OK in the Properties for
AntTutorial window.
- To test automatic publication, click . In the Clean window,
select Clean projects selected below; then select AntTutorial and
click OK.
- 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.