Developing Web Applications With Ant by Richard Hightower - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

A build script that calls other build scripts.

The ant task runs a specified build file. You have the option of specifying the build file name or just the directory. (The application uses the file build.xml in the directory specified by the dir attribute.) You can also specify a target that you want to execute. If you do not specify a target, the application uses the default target. Any properties that you set in the called project are available to the nested build file.

Here are some examples. First, to call a build file from the current build file and pass a property:

<ant antfile="./hello/build.xml">
<property name="production" value="true"/>
</ant>

Next, to call a build file from the current build file (since an Ant file is not specified, it uses ./hello/build.xml):

 

<ant dir="./hello"/>

 

Finally, to call a build file from the current build file and specify the run target that you want to execute (if the run target is not the default target, it will be executed anyway):

 

<ant antfile="./hello/build.xml" target="run"/>