Ant在eclipse中的build.xml的配置
<?xml version="1.0" ?>
- <project name="webmodulebuilder" default="deploy" basedir=".">
- <!--
set global properties for this build
-->
- <!--
发布WEB路径
-->
<property name="DEPLOY_PATH" value="C:\Tomcat 5.5\webapps\jieshengda" />
- <!--
源WEB路径
-->
<property name="WEB_PATH" value="D:\EclipseWork\jiedasheng\WebRoot" />
- <!--
源编译的jar包路径
-->
<property name="JAR_PATH" value="D:\EclipseWork\jiedasheng\WebRoot\WEB-INF\lib" />
- <!--
源java文件路径
-->
<property name="SCR_PATH" value="D:\EclipseWork\jiedasheng\src" />
- <!--
源class文件路径
-->
<property name="CLASS_PATH" value="D:\EclipseWork\jiedasheng\WebRoot\WEB-INF\classes" />
- <!--
定义classpath
-->
- <path id="LIB_CLASS_PATH">
<fileset file="${JAR_PATH}/*.jar" />
<pathelement path="${CLASS_PATH}" />
</path>
- <!--
初试化
-->
- <target name="init">
<mkdir dir="${DEPLOY_PATH}" />
<mkdir dir="${DEPLOY_PATH}/WEB-INF" />
<mkdir dir="${DEPLOY_PATH}/WEB-INF/classes" />
<mkdir dir="${DEPLOY_PATH}/WEB-INF/lib" />
</target>
- <!--
编译类
-->
- <target name="compile" depends="init" description="compile the source files">
<mkdir dir="${CLASS_PATH}" />
- <javac srcdir="${SCR_PATH}" destdir="${CLASS_PATH}">
<classpath refid="LIB_CLASS_PATH" />
</javac>
</target>
- <!--
Copy发布
-->
- <target name="deploy" depends="init,compile">
- <copy todir="${DEPLOY_PATH}">
- <fileset dir="${WEB_PATH}">
<include name="**/*.*" />
<exclude name="**/jsp_servlet/*.class" />
<exclude name="**/build.xml" />
<exclude name="**/deploy.xml" />
<exclude name="**/build.properties" />
<exclude name="**/servers.xml" />
<exclude name="**/targets.xml" />
<exclude name="**/*.war" />
</fileset>
</copy>
</target>
</project>