Developing Web Applications With Ant by Richard Hightower - HTML preview
Download the book in PDF, ePub, Kindle for a complete version.
Creating a Master Build File
We can control the execution of two build files by using a master build file. The master build file shown in Listing 20.19 is located in the root directory of the Model 2 Hello World Example of the main project. This build file treats the model and application build files as subprojects (the model and application projects are the first of many subprojects that we want to fit into a larger project).
<project name="main" default="build" ><property name="outdir" value="/tmp/app" />
<target name="init" description="initialize the properties."> <property name="lib" value="${outdir}/lib" /> </target>
<target name="clean" depends="init"
description="clean up the output directories.">
<ant dir="./Model" target="clean">
<property name="outdir" value="${outdir}" />
</ant>
<ant dir="./Application" target="clean"> <property name="outdir" value="${outdir}" />
</ant>
</target>
<target name="prepare" depends="init"
description="prepare the output directory."> <mkdir dir="${build}" />
<mkdir dir="${lib}" />
<target name="build" depends="prepare"
description="build the model and application modules.">
<ant dir="./model" target="package">
<property name="outdir" value="${outdir}" />
</ant>
<ant dir="./application" target="package"> <property name="outdir" value="${outdir}" />
</ant>
</target>
