Ant打war包的小例子

<?xml version="1.0" encoding="UTF-8"?>

<project name="Testing" default="build" basedir=".">

	<property name="build_resource.dir" value="." />
	<property name="work.space" value="." />
	<property name="j2ee6.dir" value="${build_resource.dir}/J2EE6" />
	<property name="j2ee5.dir" value="${build_resource.dir}/J2EE5" />
	
	<!-- 1, 开始build-->
	<target name="build" depends="clean,compile.dev">

	</target>


	<target name="compile.dev" description="Compile Java Files">
		<compile configDir="config" deliveryDir="deliverables_for_dev_env" />
	</target>



	<!-- compile -->
	<macrodef name="compile" description="Compile Java Files">
		<!--定义变量,configDir,deliveryDir为参数-->
		<attribute name="configDir" />
		<attribute name="deliveryDir" />
		<sequential>

			<javac destdir="${work.space}/WebRoot/WEB-INF/classes" debug="true" deprecation="false" optimize="false" failοnerrοr="true" encoding="UTF-8">
				<src path="${work.space}/src" />
				<classpath>
					<fileset dir="${work.space}/WebRoot/WEB-INF/lib">
						<include name="**/*.jar" />
					</fileset>
					<fileset dir="${j2ee6.dir}">
						<include name="**/*.jar" />
					</fileset>
				</classpath>
			</javac>

			<copy todir="${work.space}">
				<fileset dir="${work.space}/config">
					<include name="**/*.properties" />
				</fileset>
			</copy>


			<war warfile="${work.space}/@{deliveryDir}/Testing.war" webxml="${work.space}/WebRoot/WEB-INF/web.xml">
				<fileset dir="${work.space}/WebRoot">
				</fileset>
			</war>

		</sequential>
	</macrodef>
				
	<target name="clean">
			<delete dir="${work.space}/deliverables_for_dev_env" />
		</target>		
				
</project>

一个web项目的打war包ant脚本。大家可以借鉴一下
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值