<?xml version="1.0" encoding="UTF-8"?>
<project name='Azure_Ejb_ContainerTransaction' default='ear' basedir='.'>

	<property name='proj.dir' value='CT_EJB_ContainerTransaction_web'></property>
	<property name='war.home' value='bin'/>
	<property name='war.metainf' value='${war.home}/META-INF'/>
	<property name='war.webinf' value='${war.home}/WEB-INF'/>
	<property name='war.class' value='${war.webinf}/classes'/>
	<property name='war.webinf.metainf' value='${war.class}/META-INF'/>
	<property name='war.lib' value='${war.webinf}/lib'/>
	
	<import file='../build.xml' />
	
	<!--清除目录-->
	<target name='clean'>
		<delete dir='dist'/>
		<delete dir='bin'/>
	</target>
	
	<!--创建必要的目录 -->
	<target name='init' depends='clean'>
		<mkdir dir='${war.home}'></mkdir>
		<mkdir dir='${war.metainf}'></mkdir>
		<mkdir dir='${war.webinf}'></mkdir>
		<mkdir dir='${war.class}'></mkdir>
		<mkdir dir='${war.webinf.metainf}'></mkdir>
		<mkdir dir='${war.lib}'></mkdir>
	</target>

	<!--编译Web -->
	<target name='compile-web' depends='init'>
		<javac srcdir='${proj.dir}/src' destdir='${war.class}'
			includeantruntime="true">
			<classpath refid="classpath" />
		</javac>
	</target>
	
	<!--打包War -->
	<target name='war' depends='compile-web'>
	<!--
		<copy todir="${war.metainf}">
			<fileset dir="${proj.dir}/WebContent/META-INF/">
				<include name="*.xml" />
			</fileset>
		</copy>
	-->
		<copy todir="${war.home}">
			<fileset dir="${proj.dir}/WebContent">
				<include name="*.jsp" />
			</fileset>
		</copy>
		<copy todir="${war.webinf}">
			<fileset dir="${proj.dir}/WebContent/WEB-INF">
				<include name="*.xml" />
			</fileset>
		</copy>
		<copy todir="${war.lib}">
			<fileset dir="${proj.dir}/WebContent/WEB-INF/lib">
				<include name="*.jar" />
			</fileset>
		</copy>
		<copy todir="${war.webinf.metainf}">
			<fileset dir="${proj.dir}/src/META-INF/">
				<include name="*.xml" />
			</fileset>
		</copy>
		
		<mkdir dir='dist'></mkdir>
		<war destfile='dist/${proj.dir}.war' webxml='${war.webinf}/web.xml'>
			<fileset dir='${war.home}' includes='**/*.jsp' />
			<lib dir='${war.lib}' />
			<classes dir='${war.class}'/>
			
		</war>
	</target>
	
	<target name="dist" depends="war"/>
	
	<!-- deploy War -->
	<target name="deploy">
		<deploy appName="${proj.dir}" type="war"/>
	</target>
	<target name="undeploy">
		<undeploy compName="${proj.dir}"/>
	</target>
</project>