![Free-eBooks.net](/resources/img/logo-nfe.png)
![All New Design](/resources/img/allnew.png)
This project has many more components than the other subprojects. As you would expect, the Web application project build file (see Listing 20.23) is much more complex, but it builds on the foundation set by the model project--that is, the Web application project build file has the same base targets with the same meanings: init, clean, delete, prepare, mkdir, compile, package, and all.
To the base targets, the Web application project build file adds the prepare_metadata and deploy targets. The prepare_metadata target sets up the Ant filtering for the deployment descriptor. The deploy target adds the ability to deploy to both Tomcat and Resin Web application servers. The remaining details of this build file are covered in the applet and the enterprise beans sections later in this chapter.
<project name="webapplication" default="all" ><target name="init" description="initialize the properties."> <property name="local_outdir" value="${outdir}/webapps" /> <property name="lib" value="${outdir}/lib" />
<property name="dist" value="${outdir}/dist" />
<delete file="${deploy_resin}/hello.war" /> <delete dir="${deploy_resin}/hello" /> <delete file="${deploy_tomcat}/hello.war" /> <delete dir="${deploy_tomcat}/hello" />
</target><target name="prepare" depends="init"
description="prepare the output directory."> <mkdir dir="${build}" />
<mkdir dir="${dist}" />
<mkdir dir="${build_lib}" />
<fileset dir="${lib}">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${jsdk_lib}"> <include name="**/*.jar"/>
</fileset>
<fileset dir="${build_lib}"> <include name="**/*.jar"/>
</fileset>
<copy todir="${meta}" filtering="true">
<fileset dir="./meta-data"/>
</copy>
</target>
<war warfile="${dist}/hello.war" webxml="${meta}/web.xml"> <!-
Include the html and jsp files.
Put the classes from the build into the classes
/-->
<fileset dir="./HTML" /> <fileset dir="./JSP" />
<!-- Include all of the jar files except the ejbeans and applet. The other build files that create jars have to be run in the correct order. This is covered later.
/-->
<lib dir="${lib}" >
<exclude name="greet-ejbs.jar"/>
<exclude name="helloapplet.jar"/>