  <!-- include compiled-servlet and tomcat-dir properties -->
  <property file="global.properties" />
  <property name="model" location="classes" /> 
  
<path id="servlet-classpath">
    <fileset dir="$(tomcat.dir}/common/lib">
        <include name="*.jar" />
    </fileset>
    <fileset dir="${tomcat.dir}/common/endorsed">
        <include name="*.jar" />
    </fileset>
</path>

<target name="echo">
  <echo message="echo:        List commands." />
  <echo message="compile:     Compiles source." />
  <echo message="clean:       Deletes non-necessary files." />
  <echo message="create-war:  Creates the WAR file." />
  <echo message="javadoc:     Generates the Javadoc." /> 
</target>

<target name="compile">
    <echo message="Compiling the servlet...."/>
    <javac srcdir="${src}" destdir="${build}"
        includes="com/gmscheduler/model/**,com/gmscheduler/web/**">
        <classpath refid="project.classpath"/> 
    </javac>

    <copy todir="${build}">
        <fileset dir="${src}">
            <include name="**/**/*.hbm.xml"/>
        </fileset>
    </copy>

    <copy todir="${build}">
        <fileset dir=".">
            <include name="hibernate.cfg.xml"/>
        </fileset>
    </copy>

</target>

<target name="clean">
  <echo message="Deleting and remaking the build and dist directories." />
  <delete dir="${build}" /> 
  <mkdir dir="${build}" /> 
  <mkdir dir="${dist}" /> 
  <mkdir dir="${dist}" /> 
</target>

<target name="create-war" description="creates war file" depends="clean, compile">
  <echo message="Creating ${web-app-name}.war" />
  <war destfile="${dist}/${web-app-name}.war" 
       webxml="${etc}/web.xml">
       <classes dir="${build}" />
       <lib dir="${lib}"/>
       <fileset dir="${web}" />
  </war>
</target>

<target name="deploy-war" depends="create-war">
   <copy todir="${war.destination}">
      <fileset dir="${dist}">
         <include name="${web-app-name}.war" />
      </fileset>
   </copy>
</target>

<target name="javadoc">
  <delete dir="${javadoc.build}" />
  <mkdir dir="${javadoc.build}" />
  <javadoc
  packagenames="com.gmscheduler.web.*,com.gmscheduler.model.*"
  sourcepath="${src}" destdir="${javadoc.build}" author="true" version="true" use="true"
  classpath="${tomcat.jar}" >
  </javadoc>
</target>

