项目build.xml文件

 

<?xml version="1.0" encoding="UTF-8"?>
<!--  
     @author nassir Wen
     @version 2.0
     @date 2011-6-22
     payCenter war包构建  顺序:clear -> init -> compile -> war
-->
<project basedir="." name="payCenter" default="all">
	<property name="project" value="payCenter" />
	<property name="tomcat.home.lib" value="D:\apps\apache-tomcat-7.0.12\lib" />
	<property name="webapp" value="${basedir}/WebRoot" />
	<property name="lib" value="${webapp}/WEB-INF/lib" />
	<property name="classes" value="${webapp}/WEB-INF/classes" />
	<property name="war" value="${basedir}/war" />

	<!--每个包以命名:(项目名-年月日-时.zip)-->
	<tstamp prefix="datetime">
		<format property="day" pattern="yyyyMMdd" />
		<format property="hour" pattern="HH" />
	</tstamp>
	<target name="all" depends="clean,init,compile,antwar" description="Build ALL" />

	<target name="init" description="init">
		<echo message="init..." />
		<mkdir dir="${classes}" />
		<mkdir dir="${war}" />
		<path id="javac.classpath">
			<fileset dir="${lib}">
				<include name="*.jar" />
			</fileset>
			<fileset dir="${tomcat.home.lib}">
				<include name="*.jar" />
			</fileset>
		</path>
	</target>

	<target name="compile" description="compile all java">
		<echo message="compile all java..." />
		<javac destdir="${classes}" encoding="GBK" debug="on">
			<src path="src" />
			<classpath refid="javac.classpath" />
		</javac>
		<copy todir="${classes}">
			<fileset dir="src" excludes="**/**/*.java"/>
			<fileset dir="resources" excludes="**/**/*.java"/>
		</copy>
	</target>

	<target name="antwar" description="build war">
		<echo message="build war..." />
		<!--zip包压缩-->
		<zip destfile="${war}/${project}-${datetime.day}-${datetime.hour}.zip">
			<zipfileset dir="${webapp}" prefix="payCenter" />
		</zip>
		<!--<war warfile="${war}/payCenter-${datetime.day}-${datetime.hour}.zip" webxml="${webapp}/WEB-INF/web.xml">
			<fileset dir="${webapp}" />
		</war>-->
	</target>

	<target name="clean" description="clean the classes">
		<echo message="clean the classes..." />
		<!--与eclipse编译环境共用classes不用删除-->
		<!--<delete dir="${classes}" includeemptydirs="true" quiet="true" />-->
	</target>
</project>

你可能感兴趣的:(apache,eclipse,tomcat,xml,Web)