`

Ant使用

    博客分类:
  • Java
 
阅读更多

<?xml version="1.0" encoding="utf-8"?>
<project name="spring_game" default="dist" basedir=".">
	<description>
        simple example build file 
    </description>
	<!-- set global properties for this build -->
	<property name="app" value="spring_game" />
	<property name="src" location="WEB-INF/src" />
	<property name="build" location="WEB-INF" />
	<property name="dist" location="../ant/dist" />
	<property name="lib" location="lib" />
	<property name="WebContent" location="../WebContent" />
	<property name="META-INF" location="META-INF" />
	<!-- local taget dir -->
	<property name="LocalTomcat" location="/home/xusongqin/workspace/programs/apache-tomcat-7.0.47" />

	<target name="clean" description="clean up">
		<echo message="########## (clean) the ${dist} !##########" />
		<!-- Delete the ${build} and ${dist} directory trees -->
		<delete dir="${dist}" />
	</target>
	<target name="init">
		<echo message="########## (init and mkdir) the ${dist} !##########" />
		<!-- Create the time stamp -->
		<tstamp />
		<!-- Create the build directory structure used by compile -->
		<mkdir dir="${dist}" />
	</target>
	<target name="makedir">
		<echo message="########## (init and mkdir) the ${dist} sub dir !##########" />
		<echo message="########## (init and mkdir) the ${dist}/${app} !##########" />
		<echo message="########## (init and mkdir) the ${dist}/${app}/WEB-INF/classes !##########" />
		<echo message="########## (init and mkdir) the ${dist}${dist}/${app}/WEB-INF/lib !##########" />
		<echo message="########## (init and mkdir) the ${dist}/${app}/META-INF !##########" />
		<echo message="########## (init and mkdir) *.jsp file the ${dist}/${app}/public !##########" />
		<mkdir dir="${dist}/${app}" />
		<mkdir dir="${dist}/${app}/WEB-INF/classes" />
		<mkdir dir="${dist}/${app}/WEB-INF/lib" />
		<mkdir dir="${dist}/${app}/META-INF" />
		<mkdir dir="${dist}/${app}/public" />
	</target>

	<target name="dist" depends="clean,init,makedir" description="dist">
		<echo message="##########copy WebContent to dist spring_game{$WebContent})!##########" />
		<copy todir="${dist}/${app}/">
			<fileset dir="/${WebContent}" />
		</copy>
	</target>

	<!--local-->
	<target name="local_server" depends="dist">
		<echo message="clean local server project:${LocalTomcat}/webapps/${app}" />
		<delete dir="${LocalTomcat}/webapps/${app}" />
		<echo message="#####copy all files to ${LocalTomcat} ########" />
		<copy todir="${LocalTomcat}/webapps">
			<fileset dir="${dist}" />
		</copy>
	</target>

	<target name="local_class" depends="dist">
		<echo message="#####copy all files to ${LocalTomcat} ########" />
		<copy todir="${LocalTomcat}/webapps/${app}/WEB-INF/classes">
			<fileset dir="${dist}/${app}/WEB-INF/classes" />
		</copy>
	</target>
	<target name="local_WebContent">
		<echo message="#####copy all files to ${LocalTomcat} ########" />
		<copy todir="${LocalTomcat}/webapps/${app}/">
			<fileset dir="${WebContent}" />
		</copy>
	</target>
	<target name="local_webxml">
		<echo message="###########copy web xml to ${LocalTomcat}/webapps/${app}/WEB-INF#######" />
		<copy todir="${LocalTomcat}/webapps/${app}/WEB-INF">
			<fileset dir="${WebContent}/WEB-INF">
				<include name="*.xml" />
				<include name="*.*" />
			</fileset>
		</copy>
	</target>

	<!-- 
		<property name="RemoteTomcat" value="/data/projects/apache-tomcat-7.0.47" />
		<property name="server" value="192.168.1.123" />
		<property name="username" value="songqin" />
		<property name="password" value="123" />
	
		<target name="remote_server" depends="dist">
			<echo message="#####copy all files to ${RemoteTomcat}/webapps/########" />
			<scp todir="${username}@${server}:${RemoteTomcat}/webapps/" port="22" password="${password}" trust="true">
				<fileset dir="${dist}/" />
			</scp>
		</target>
	-->
</project>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics