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.

Creating a Master Build File

Applications can include many components that can be reused by other applications. In addition, components can be written to target more than one application server. An application may consist of a large project that depends on many smaller projects, and these smaller projects also build components. Because Ant allows one Ant build file to call another, you may have an Ant file that calls a hierarchy of other Ant build files. Listing 20.7 shows a sample build script that calls other build scripts. The application project can direct the building of all its components by passing sub build files certain properties to customize the build for the current application.

<project name="main" default="build" >
...
<target name="build" depends="prepare"
description="build the model and application modules.">

<ant dir="./model" target="package">
<property name="outdir" value="/tmp/app" /> <property name="setProps" value="true" />

</ant>

<ant dir="./application" target="package"> <property name="outdir" value="/tmp/app" /> <property name="setProps" value="true" />

</ant> ...
</target> </project>

 

Listing 20.7