ant的任务实例

deploy.path=/data/jsp/xxxxxxxx.com

<?xml version="1.0"?>
<project name="xxxx" basedir="." default="usage">
	<property file="build.properties"/>
	<property name="src.dir" value="src"/>
	<property name="web.dir" value="WebRoot"/>
	<property name="build.dir" value="${web.dir}/WEB-INF/classes"/>
	<property name="name" value="webapps"/>
	<path id="master-classpath">
		<fileset dir="${web.dir}/WEB-INF/lib">
			<include name="*.jar"/>

		</fileset>
		<pathelement path="${build.dir}"/>

	</path>
	<target name="usage">
		<echo message=""/>
		<echo message="${name} build file"/>
		<echo message="-----------------------------------"/>
		<echo message=""/>
		<echo message="Available targets are:"/>
		<echo message=""/>
		<echo message="build --> Build the application"/>
		<echo message="deploy --> Deploy application as directory"/>
		<echo message="deploywar --> Deploy application as a WAR file"/>
		<echo message=""/>
	</target>
	<target name="build" description="Compile main source tree java files">
		<mkdir dir="${build.dir}"/>
		<javac destdir="${build.dir}" source="1.5" target="1.5" debug="true" deprecation="false" optimize="false"
			   failοnerrοr="true" includeantruntime="false" encoding="GBK">
			<src path="${src.dir}"/>
			<classpath refid="master-classpath"/>
		</javac>
		<copy todir="${build.dir}" preservelastmodified="true">
		<fileset dir="${src.dir}">

				<!--<include  name="**/*.*"/>-->
				<exclude name="**/*.java"/>
			</fileset>
		</copy>
	</target>
	<target name="deploy" depends="build" description="Deploy application">

		<mkdir dir="${deploy.path}/${name}"/>

		<copy todir="${deploy.path}/${name}" preservelastmodified="true">

			<fileset dir="${web.dir}">

				<include name="**/*.*"/>

			</fileset>
		</copy>
	</target>
	<target name="deploywar" depends="build" description="Deploy application as a WAR file">
		<war destfile="${name}.war" webxml="${web.dir}/WEB-INF/web.xml">
			<fileset dir="${web.dir}">
			<include name="**/*.*"/>
			</fileset>
		</war>
		<copy todir="${deploy.path}" preservelastmodified="true">
			<fileset dir=".">
				<include name="*.war"/>
			</fileset>
		</copy>
	</target>
	<target name="clean" description="Clean output directories">
		<delete>
			<fileset dir="${build.dir}">
				<include name="**/*.*"/>
			</fileset>
		</delete>
	</target>
	<target name="undeploy" description="Un-Deploy application">
		<delete>
			<fileset dir="${deploy.path}/${name}">
				<include name="**/*.*"/>
			</fileset>
		</delete>
	</target>
</project> 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值