ant build.xml

<?xml version="1.0" encoding="UTF-8"?>
<project name="foo" basedir="../" default="clean">

	
	<property name="TOMCAT_HOME" value="C:/Users/XXX/server/apache-tomcat-6.0.37-8081" />
	<property name="APP_NAME" value="foo" />

	<property name="web.content" value="WebContent" />
	<property name="WEBCONTENT" location="WebContent" />
	<property name="WEBINF" location="${WEBCONTENT}/WEB-INF" />
	<property name="CLASSES" location="${WEBINF}/classes" />
	<property name="LIBS" location="${WEBINF}/lib" />
	<property name="LIBS_TO_COMPILE" location="lib" />
	<property name="OTHER_LIBS_TO_COMPILE" location="lib_other" />
	<property name="DIST" location="dist" />
	<property name="SRC" location="src" />

	<path id="build.class.path">
		<fileset dir="${LIBS}">
			<include name="**/*.jar" />
		</fileset>
		<fileset dir="${LIBS_TO_COMPILE}">
			<include name="**/*.jar" />
		</fileset>
		<fileset dir="${OTHER_LIBS_TO_COMPILE}">
			<include name="**/*.jar" />
		</fileset>
	</path>


	<target name="clean">
		<delete dir="${DIST}" />
		<delete dir="${CLASSES}" />
		<mkdir dir="${DIST}" />
		<mkdir dir="${CLASSES}" />
		<!--
		<delete>
			<fileset dir="${CLASSES}">
				<include name="**/*.xml" />
				<include name="**/*.properties" />
				<include name="**/*.list" />
				<include name="**/*.MD5" />
				<include name="**/*.class" />
			</fileset>
		</delete>
		-->
	</target>

	<target name="compile" depends="clean">
		<javac srcdir="${SRC}" destdir="${CLASSES}" includeantruntime="false" compiler="javac1.6" nowarn="true" fork="true" memoryinitialsize="128m" memorymaximumsize="512m" debug="false" debuglevel="lines,var,source" verbose="false">
			<classpath>
				<path refid="build.class.path" />
			</classpath>
		</javac>
		<!-- <antcall target="copyFilesToClasspath" /> -->
	</target>

	<!-- - - - - - - - - - - - - - - - - - 
          target: copyFilesToClasspath                      
         - - - - - - - - - - - - - - - - - 
	<target name="copyFilesToClasspath">
		<copy todir="${CLASSES}">
			<fileset dir="${RESOURCES}" />
			<fileset dir="${SRC}">
				<exclude name="**/*.java" />
			</fileset>
		</copy>
	</target>

	<target name="loadSVNInfo">
		<loadfile property="svn.revision" srcFile=".svn/entries" failonerror="true">
			<filterchain>
				<headfilter lines="1" skip="3" />
				<deletecharacters chars="\n" />
			</filterchain>
		</loadfile>
		<loadfile property="svn.url" srcFile=".svn/entries" failonerror="true">
			<filterchain>
				<headfilter lines="1" skip="4" />
				<deletecharacters chars="\n" />
			</filterchain>
		</loadfile>
		<loadfile property="svn.lastcommit" srcFile=".svn/entries" failonerror="true">
			<filterchain>
				<headfilter lines="1" skip="9" />
				<deletecharacters chars="\n" />
			</filterchain>
		</loadfile>
		<tstamp>
			<format property="package.build.time" pattern="dd-MMMM-yyyy hh:mm:ss" locale="en,US" />
		</tstamp>
	</target>
-->
	<target name="war" depends="compile">
		<war destfile="${DIST}/${APP_NAME}.war" update="false">
			<fileset dir="${WEBCONTENT}">
				<include name="**/*" />
			</fileset>
			<!--
			<manifest>
				<attribute name="Package-BuildTime" value="${package.build.time}" />
				<attribute name="SVN-Revision" value="${svn.revision}" />
				<attribute name="SVN-URL" value="${svn.url}" />
				<attribute name="SVN-Checkout-User" value="${svn.checkout.user}" />
				<attribute name="SVN-LastCommit-Time" value="${svn.lastcommit}" />
			</manifest>
			-->
		</war>
	</target>
<!--
	<target name="server-war" depends="war">
	</target>

	<target name="all" depends="war" description="compiles and packs webapp">
	</target>
-->
	<target name="publish" depends="war" description="copy war to tomcat">
		<copy todir="${TOMCAT_HOME}/webapps">
			<fileset dir="${DIST}">
				<include name="${APP_NAME}.war" />
			</fileset>
		</copy>
	</target>
</project>



你可能感兴趣的:(ant build.xml)