<?xml version="1.0" encoding="UTF-8"?>
<project name="Ant.Build.xml" default="compile" basedir=".">
<!-- Application URL -->
<property name="app.name" value="TomcatProject"/>
<property name="app.path" value="/${app.name}"/>
<property name="app.version" value="2.0-dev"/>
<!-- Tomcat -->
<property name="catalina.home" value="C:/apache-tomcat-6.0.24"/>
<property name="catalina.home.webapps" value="${catalina.home}/webapps"/>
<!-- Tomcat Manager -->
<property name="manager.url" value="http://localhost:8080/manager"/>
<property name="manager.username" value="admin"/><!-- UPDATE THIS! -->
<property name="manager.password" value=""/><!-- UPDATE THIS! -->
<!-- Project -->
<property name="src.dir" value="${basedir}/src"/>
<property name="lib.dir" value="${basedir}/WebContent/WEB-INF/lib"/>
<property name="class.dir" value="${basedir}/WebContent/WEB-INF/classes"/>
<property name="jar.dir" value="${basedir}/WebContent/WEB-INF/lib"/>
<property name="jar.name" value="${app.name}.jar"/>
<property name="war.dir" value="${basedir}"/>
<property name="war.name" value="${app.name}.war"/>
<property name="compile.debug" value="true"/>
<property name="compile.deprecation" value="false"/>
<property name="compile.optimize" value="true"/>
<!-- Extra Lib For Compile -->
<path id="compile.classpath">
<!-- Lib Path of Tomcat-->
<pathelement location="${catalina.home}/classes"/>
<fileset dir="${catalina.home}/lib">
<include name="*.jar"/>
</fileset>
<!--Project Lib Path-->
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
</path>
<!-- taskdefタグでタスクを宣言する。 -->
<taskdef name="list"
classname="org.apache.catalina.ant.ListTask"/>
<taskdef name="install"
classname="org.apache.catalina.ant.InstallTask"/>
<taskdef name="remove"
classname="org.apache.catalina.ant.RemoveTask"/>
<taskdef name="start"
classname="org.apache.catalina.ant.StartTask"/>
<taskdef name="stop"
classname="org.apache.catalina.ant.StopTask"/>
<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"/>
<taskdef name="resources"
classname="org.apache.catalina.ant.ResourcesTask"/>
<taskdef name="roles"
classname="org.apache.catalina.ant.RolesTask"/>
<target name="all" depends="war" description="Clean build and dist directories, then compile"/>
<target name="clean"
description="Delete old build and dist directories">
<delete dir="${class.dir}" includes="**/*.*"/>
<delete dir="${jar.dir}" includes="**/*.jar"/>
</target>
<target name="compile" description="Compile Java sources" depends="clean">
<!-- Compile Java classes as necessary -->
<mkdir dir="${class.dir}"/>
<javac srcdir="${src.dir}" destdir="${class.dir}" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}">
<classpath refid="compile.classpath"/>
</javac>
<copy todir="${class.dir}">
<fileset dir="${src.dir}" excludes="**/*.java"/>
</copy>
</target>
<target name="jars" depends="compile">
<jar jarfile="${jar.dir}/${jar.name}" basedir="${class.dir}"></jar>
</target>
<target name="war" depends="jars">
<war warfile="${war.dir}/${war.name}" webxml="${basedir}/WebContent/WEB-INF/web.xml">
<fileset dir="${basedir}/WebContent">
<include name="**/*.jsp"/>
</fileset>
<classes dir="${class.dir}">
<include name="**/*.class"/>
</classes>
<lib dir="${jar.dir}">
<include name="**/*.jar"/>
</lib>
</war>
<!--copy todir="${catalina.home.webapps}">
<fileset dir="${basedir}" includes="*.war"/>
</copy-->
</target>
<target name="list">
<list url="${manager.url}"
username="${manager.username}"
password="${manager.password}"/>
</target>
<target name="install" description="Install application to servlet container">
<install url="${manager.url}"
username="${manager.username}"
password="${manager.password}"
path="${app.path}"
war="file://${war.dir}/${war.name}"/>
</target>
<target name="reload" description="Reload application on servlet container">
<reload url="${manager.url}"
username="${manager.username}"
password="${manager.password}"
path="${app.path}"/>
</target>
<target name="remove" description="Remove application on servlet container">
<remove url="${manager.url}"
username="${manager.username}"
password="${manager.password}"
path="${app.path}"/>
</target>
<target name="start">
<start url="${manager.url}"
username="${manager.username}"
password="${manager.password}"
path="${app.path}"/>
</target>
<target name="stop">
<stop url="${manager.url}"
username="${manager.username}"
password="${manager.password}"
path="${app.path}"/>
</target>
<target name="deploy">
<echo level="info">拷贝StudyPro文件到调试目录</echo>
<deploy url="${manager.url}"
username="${manager.username}"
password="${manager.password}"
path="${app.path}"
war="file://${war.dir}/${war.name}"/>
</target>
<target name="undeploy">
<undeploy url="${manager.url}"
username="${manager.username}"
password="${manager.password}"
path="${app.path}"
/>
</target>
</project>