ant範例

<?xml version="1.0" encoding="UTF-8" ?>
<project name="oppo-sync-webclient" default="deploy" basedir=".">
	<property name="sync.version" value="1.0.0" />
	<path id="path.svnant">
		<pathelement location="../ant-lib/svnjavahl.jar" />
		<pathelement location="../ant-lib/svnClientAdapter.jar" />
		<pathelement location="../ant-lib/svnant.jar" />
		<pathelement location="../ant-lib/svnkit.jar" />
		<pathelement location="../ant-lib/ganymed.jar" />
		<pathelement location="../ant-lib/jna.jar" />
	</path>
	<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="path.svnant" />
	<target name="svn">
		<svn username="username" password="pwd">
			<update revision="HEAD" dir="../sync-lib" />
		</svn>
	</target>
	<target name="deploy" depends="svn">
		<!--copy libraries-->
		<copy file="../sync-lib/server-framework.jar" todir="sync-server/WebContent/WEB-INF/lib" />
		<copy file="../sync-lib/ds-server.jar" todir="sync-server/WebContent/WEB-INF/lib" />
		<copy file="../sync-lib/pim-parse.jar" todir="sync-server/WebContent/WEB-INF/lib" />
		<copy file="../sync-lib/pim-framework.jar" todir="sync-server/WebContent/WEB-INF/lib" />
		<copy file="../sync-lib/foundation-core.jar" todir="sync-server/WebContent/WEB-INF/lib" />
		<copy file="../sync-lib/sso-2.0.0.jar" todir="sync-server/WebContent/WEB-INF/lib" />
		<copy file="../sync-lib/sso-tools-1.0.0.jar" todir="sync-server/WebContent/WEB-INF/lib" />
		<copy file="../sync-lib/tools-1.0.0.jar" todir="sync-server/WebContent/WEB-INF/lib" />
		<copy file="../sync-lib/push-core.jar" todir="sync-server/WebContent/WEB-INF/lib" />
		<copy file="../sync-lib/push-client-sdk.jar" todir="sync-server/WebContent/WEB-INF/lib" />
		<!--compile source-->
		<javac encoding="utf-8" target="1.6" debug="true" extdirs="" destdir="sync-server/WebContent/WEB-INF/classes">
			<classpath>
				<fileset dir="sync-server/WebContent/WEB-INF/lib" includes="*.jar" />
			</classpath>
			<src path="sync-server/src" />
			<include name="*.properties"/>
			<include name="*.xml"/>
		</javac>
		<!--export war-->
		<war warfile="deploy/sync_server.war" webxml="sync-server/WebContent/WEB-INF/web.xml">
			<fileset dir="sync-server/WebContent" />
		</war>
		<!--commit jar-->
		<tstamp>
			<format property="TODAY" pattern="yyyy/MM/dd hh:mm:ss" />
		</tstamp>
		<svn username="liupeng" password="liu-1031">
			<commit message="${TODAY}-${user.name}" dir="sync-server/WebContent/WEB-INF/lib" />
		</svn>
	</target>
</project>

<?xml version="1.0" encoding="UTF-8" ?>
<project name="ocloud-deploy" default="deploy" basedir=".">
	<target name="deploy">
		<ant antfile="server-framework/deploy.xml" target="compile">
        </ant>
		<ant antfile="ds-server/deploy.xml" target="compile">
        </ant>
		<ant antfile="pim-parse/deploy.xml" target="compile">
        </ant>
		<ant antfile="pim-framework/deploy.xml" target="compile">
        </ant>
		<ant antfile="foundation-core/deploy.xml" target="compile">
        </ant>
		<ant antfile="uc/deploy.xml" target="deploy">
        </ant>
		<ant antfile="sync-webapp/deploy.xml" target="deploy">
        </ant>
		<ant antfile="sync-server/deploy.xml" target="deploy">
        </ant>
	</target>
</project>

cmd中執行ant

@echo OFF
setlocal

set BUILD_HOME=%~dp0

cd %BUILD_HOME%
call ant -buildfile build.xml %*

:END
endlocal



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章