我的build.xml

<project name="GoTo1234" default="build-zip">

	<!-- <property file="build.properties" /> -->
	<property name="project.dir" value="${basedir}" />
	<property name="output.dir" value="${basedir}/build/goto1234" />
	<property name="war.name" value="goto1234.war" />
	<property name="zip.name" value="goto1234.zip" />
	<!-- <property name="zip.output" value="build" /> -->
	<property name="zip.output" value="D:\Personal\Desktop" />

	<path id="gwt.compiler.class.path">
		<pathelement location="${project.dir}/domain/src" />
		<pathelement location="${project.dir}/gwt/src" />
		<pathelement location="${project.dir}/gwt-hibernate-patch" />
		<pathelement location="${project.dir}/server/src" />
		<pathelement location="${project.dir}/classes" />
		<pathelement location="${project.dir}/lib/htmlparser.jar" />
		<pathelement location="${project.dir}/lib/gwt1.5/gwt-dev-windows.jar" />
		<pathelement location="${project.dir}/lib/gwt1.5/gwt-user.jar" />
	</path>

	<macrodef name="gwt-compile">
		<attribute name="moduleName" />
		<sequential>
			<echo message="Compile gwt module:@{moduleName}" />
			<java classname="com.google.gwt.dev.GWTCompiler" fork="true">
				<classpath refid="gwt.compiler.class.path" />
				<jvmarg value="-Xmx1024m" />
				<jvmarg value="-Xms512m" />
				<!-- <jvmarg value="-Ddebug=true" /> -->
				<arg value="-out" />
				<arg value="${output.dir}" />
				<!-- <arg value="-style" /> -->
				<!-- <arg value="pretty" /> -->
				<arg value="@{moduleName}" />
			</java>
		</sequential>
	</macrodef>

	<target name="compile-gwt-modules">
		<tstamp>
			<format property="now" pattern="yyyy-MM-dd hh:mm:ss" />
		</tstamp>
		<echo message="Start compile gwt modules ${now}" />

		<parallel threadcount="1">
			<gwt-compile modulename="com.goto1234.gwt.index.Index" />
		</parallel>

		<tstamp>
			<format property="now2" pattern="yyyy-MM-dd hh:mm:ss" />
		</tstamp>
		<echo message="Complete compile gwt modules ${now2}" />
	</target>

	<target name="build-unfold-war" depends="clear, compile-gwt-modules">
		<mkdir dir="${output.dir}/WEB-INF" />
		<mkdir dir="${output.dir}/WEB-INF/lib" />
		<mkdir dir="${output.dir}/WEB-INF/classes" />

		<copy todir="${output.dir}">
			<fileset dir="${output.dir}/web" includes="*.*" />
		</copy>

		<!-- develop config file -->
		<copy file="${project.dir}/develop/config.properties" tofile="${output.dir}/WEB-INF/classes/config.properties" overwrite="true" />

		<delete dir="${output.dir}/web" />
		<delete dir="${output.dir}/web-aux" />
		<delete dir="${output.dir}/.gwt-tmp" />

		<copy todir="${output.dir}/WEB-INF/classes">
			<fileset dir="${project.dir}/classes" />
		</copy>

		<!--
		<copy todir="${output.dir}/WEB-INF/lib">
			<fileset dir="${project.dir}/lib" includes="*.jar" />
			<fileset dir="${project.dir}/lib/ejb3" includes="*.jar" />
			<fileset dir="${project.dir}/lib/gwt1.5" includes="gwt-servlet.jar" />
			<fileset dir="${project.dir}/lib/hibernate3.3" includes="*.jar" />
			<fileset dir="${project.dir}/lib/jakarta" includes="*.jar" />
			<fileset dir="${project.dir}/lib/mysql" includes="*.jar" />
			<fileset dir="${project.dir}/lib/spring2.5" includes="*.jar" />
		</copy>
		-->

		<copy file="${project.dir}/etc/web.xml" tofile="${output.dir}/WEB-INF/web.xml" />
	</target>

	<target name="clear">
		<delete dir="${output.dir}" />
		<mkdir dir="${output.dir}" />
	</target>

	<!-- prepare-host -->
	<target name="prepare-host">
		<echo message="Prepare GWT Host environment" />
		<mkdir dir="tomcat/webapps/ROOT/WEB-INF" />
		<copy todir="tomcat/webapps/ROOT/WEB-INF" overwrite="true">
			<fileset dir="server/src" includes="*.xml" />
		</copy>
		<copy file="etc/hosted-web.xml" tofile="tomcat/webapps/ROOT/WEB-INF/web.xml" overwrite="true" />
	</target>

	<!-- do not used -->
	<target name="build-war" depends="build-unfold-war">
		<delete file="build/${war.name}" />

		<war destfile="$build/${war.name}" webxml="${output.dir}/WEB-INF/web.xml">
			<fileset dir="${output.dir}">
				<exclude name="WEB-INF/web.xml" />
			</fileset>
		</war>
	</target>

	<property environment="env" />

	<target name="build-zip" depends="build-unfold-war">
		<delete file="${zip.output}/${zip.name}" />

		<zip destfile="${zip.output}/${zip.name}" basedir="${output.dir}" />
	</target>

	<target name="build-unzip">
		<unzip src="build/${zip.name}" dest="${env.TOMCAT_HOME}/webapps/" overwrite="true" />
	</target>

	<target name="build-jar">
		<jar destfile="${output.dir}/WEB-INF/lib/goto1234.jar" basedir="${project.dir}/classes" />
	</target>

	<!-- rsync -->
	<macrodef name="rsync">
		<attribute name="local" />
		<attribute name="remote" />
		<sequential>
			<echo message="Run DOS Command PLS" />
			<echo message="rsync -avz --delete -e 'ssh -l root' @{local} @{remote}" />
		</sequential>
	</macrodef>

	<!-- deploy  -->
	<target name="deploy-to-server">
		<rsync local="/cygdrive/E/workspace/com.hotye.web3.1.website/build/website/web" remote="www.hotye.com:/website/" />
		<!-- /usr/local/apache/bin/apachectl restart -->
	</target>


</project>

你可能感兴趣的:(java,apache,xml)