<project name="bookstore1" default="build" basedir=".">
   <target name="init">
       <tstamp/>
   </target>
 
   <!-- Configure the context path for this application -->
   <property name="example" value="bookstore1" />
   <property name="path" value="/${example}"/>
   <property name="example-path" value="${jwsdp.home}/docs/tutorial/examples/web/${example}" />
   <property name="build"   value="${example-path}/build" />
   <property name="war-file" value="${example}.war" />
 
   <!-- Configure properties to access the Manager application -->
   <property name="url"      value="http://localhost:8080/manager"/>
   <property file="build.properties"/>
   <property file="${user.home}/build.properties"/>
 
   <!-- Configure the custom Ant tasks for the Manager application -->
 
   <path id="classpath">
     <fileset dir="${jwsdp.home}/common/lib">
       <include name="*.jar"/>
     </fileset>
   </path>
   <taskdef name="list" classname="org.apache.catalina.ant.ListTask"/>	
   <taskdef name="install"  classname="org.apache.catalina.ant.InstallTask"/>
   <taskdef name="reload"   classname="org.apache.catalina.ant.ReloadTask"/>
   <taskdef name="remove" classname="org.apache.catalina.ant.RemoveTask"/>	
   <taskdef name="reload"   classname="org.apache.catalina.ant.ReloadTask"/>
   <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"/>	
   <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"/>	
 
   <target name="prepare" depends="init"
    	description="Create build directories.">
     <mkdir dir="${build}" />
     <mkdir dir="${build}/META-INF" />
     <mkdir dir="${build}/WEB-INF" />
     <mkdir dir="${build}/WEB-INF/classes" />
     <mkdir dir="${build}/WEB-INF/lib" />
     <mkdir dir="${example-path}/dist" />		
   </target>
 
   <!-- Executable Targets -->
 
   <target name="list" description="List web applications" >
     <list url="${url}" username="${username}" password="${password}" />
   </target>
   <target name="install" description="Install web application"
           depends="build">
     <install url="${url}" username="${username}" password="${password}"
           path="${path}" config="file:${build}/META-INF/context.xml"/>
   </target>
 
 
   <target name="reload" description="Reload web application"
           depends="build">
     <reload  url="${url}" username="${username}" password="${password}"
           path="${path}"/>
   </target>
 
   <target name="remove" description="Remove web application">
     <remove url="${url}" username="${username}" password="${password}"
           path="${path}"/>
   </target>
   
   <target name="build" depends="prepare" 
      description="Compile Java files and copy DD and static files." >
     <javac srcdir="src" destdir="${build}/WEB-INF/classes">
     	<include name="**/*.java" />
      <classpath refid="classpath"/>
     </javac>
     <copy todir="${build}/WEB-INF">
       <fileset dir="web/WEB-INF"    >
         <include name="web.xml" />
         <include name="*.tld" />
       </fileset>
     </copy>
     <copy todir="${build}">
       <fileset dir="web">
         <include name="*.html" />
         <include name="*.gif" />
         <include name="*.jsp" />
       </fileset>
     </copy>
     <copy todir="${build}/META-INF">
       <fileset dir=".">
         <include name="context.xml" />
       </fileset>
     </copy>
   </target>	 
 
   <target name="package" 
       description="Packages the WAR file">
       <echo message="Packaging the WAR...."/>
       <delete file="dist/${war-file}" />
       <jar jarfile="dist/${war-file}" >
         <fileset dir="${build}" />
       </jar>
   </target>
 
   <target name="deploy" depends="build, package"
      description="Deploy a Webapp">
       <deploy url="${url}" username="${username}" password="${password}" 
         path="${path}" war="file:${example-path}/dist/${war-file}"   
       />
   </target>
 
   <target name="undeploy" description="Undeploy web application">
     <undeploy url="${url}" username="${username}" password="${password}"
           path="${path}"/>
   </target>
 </project>