ant 脚本

build.properties
svnant.version=1.0.0

svnant.repository.user=wangxj

svnant.repository.password=123456

svnlib.dir=/usr/src/apache-ant-1.7.1/lib

svnant.jar=${svnlib.dir}/svnant.jar

svnClientAdapter.jar=${svnlib.dir}/svnClientAdapter.jar

svnjavahl.jar=${svnlib.dir}/svnjavahl.jar



jdk_home=/usr/java/jdk1.6.0_11



base.dir=/home/test/class4_ui/routers/

svnant.ui.url=svn://192.168.1.125/newclass4/branches/2.0final/UI

svnant.jarlib.url=svn://192.168.1.125/newclass4/branches/2.0final/UI/www/WEB-INF/lib

svnant.jetty.url=svn://192.168.1.125/newclass4/branches/2.0final/UI/conf/jetty

svnant.conf.url=svn://192.168.1.125/newclass4/branches/2.0final/UI/conf/conf


build.xml

<?xml version="1.0"?>

<project name="build-project" basedir="." default="main">

    

    

    <target name="main" depends="checkout_lib,checkout_ui,compile_ui,makewar"/>

    

    

    <property file="build.properties"/>

    <path id="project.classpath">

        <pathelement location="${svnjavahl.jar}"/>

        <pathelement location="${svnant.jar}"/>

        <pathelement location="${svnClientAdapter.jar}"/>

    </path>

    <taskdef resource="svntask.properties" classpathref="project.classpath"/>

    

	

	<!--*******************************************check jetty**************************************************-->

    <target name="check_jetty">

        <delete dir="${base.dir}/jetty"/>

        <mkdir dir="${base.dir}/jetty"/>

        <svn username="${svnant.repository.user}" password="${svnant.repository.password}">

            <checkout url="${svnant.jetty.url}"  destPath="${base.dir}/jetty"/>

        </svn>

    </target>

    

    

    

    <target name="clean_UI">

        <delete dir="${base.dir}/output_ui"/>

    </target>

    

    <target name="mk_UI">

        <mkdir dir="${base.dir}/output_ui"/>

        <mkdir dir="${base.dir}/output_ui/src_ui"/>

        <mkdir dir="${base.dir}/output_ui/class_ui"/>

        <mkdir dir="${base.dir}/output_ui/www_ui"/>

        <mkdir dir="${base.dir}/output_ui/web_ui"/>

    </target>

	

	  <target name="clear_UPLOAD">

	      <delete dir="${base.dir}/upload"></delete>

	  </target>

	

	  <target name="mk_UPLOAD">

	      <mkdir dir="${base.dir}/upload"/>

	  </target>

	

	<target name="clear_TEMP">

	  <delete dir="${base.dir}/temp"></delete>

	</target>

	

	<target name="mk_TEMP">

	  <mkdir dir="${base.dir}/temp"/>

	</target>

	

	

	<!--*******************************************check conf(data.properties)**************************************************-->

	<target name="check_conf" >

	  <delete dir="${base.dir}/conf"></delete>

	  <mkdir dir="${base.dir}/conf"/>

	  <svn username="${svnant.repository.user}" password="${svnant.repository.password}">

		  <checkout url="${svnant.conf.url}"  destPath="${base.dir}/conf"/>

	  </svn>

	</target>

    

    <target name="checkout_lib">

        <delete dir="${base.dir}/jar_lib"/>

        <mkdir dir="${base.dir}/jar_lib"/>

        <svn username="${svnant.repository.user}" password="${svnant.repository.password}">

            <checkout url="${svnant.jarlib.url}" revision="HEAD" destPath="${base.dir}/jar_lib"/>

        </svn>

    </target>

    

	

	<!--*******************************************bulid webui**************************************************-->

    <target name="checkout_ui" depends="clean_UI,mk_UI,clear_UPLOAD,mk_UPLOAD,clear_TEMP,mk_TEMP">

        <svn username="${svnant.repository.user}" password="${svnant.repository.password}">

            <checkout url="${svnant.ui.url}/src" revision="HEAD" destPath="${base.dir}/output_ui/src_ui"/>

        </svn>

        <svn username="${svnant.repository.user}" password="${svnant.repository.password}">

            <checkout url="${svnant.ui.url}/www" revision="HEAD" destPath="${base.dir}/output_ui/www_ui"/>

        </svn>

        <svn username="${svnant.repository.user}" password="${svnant.repository.password}">

            <checkout url="${svnant.ui.url}/www/WEB-INF" revision="HEAD" destPath="${base.dir}/output_ui/web"/>

        </svn>

    </target>

    

    

    <target name="compile_ui" description="compile_ui">

        <javac destdir="${base.dir}/output_ui/class_ui" classpath="${base.dir}/jar_lib/xmlrpc-client-3.1.1.jar:

        	                                                          ${base.dir}/jar_lib/cos.jar:

        	                                                          ${base.dir}/jar_lib/xmlrpc-common-3.1.1.jar:

                                                                   ${base.dir}/jar_lib/ws-commons-util-1.0.2.jar:

        	                                                          ${base.dir}/jar_lib/common-annotations.jar:

        	                                                          ${base.dir}/jar_lib/commons-logging.jar:

        	                                                          ${base.dir}/jar_lib/postgresql-8.1-413.jdbc3.jar:

        	${base.dir}/jar_lib/servlet-api-3.0.pre4.jar:

        	${base.dir}/jar_lib/xom-1.2b2.jar:

        	${base.dir}/jar_lib/jstl.jar:

        	${base.dir}/jar_lib/log4j-1.2.15.jar:

        	${base.dir}/jar_lib/spring-beans.jar:

        	${base.dir}/jar_lib/spring-context.jar:

        	${base.dir}/jar_lib/spring-core.jar:

        	${base.dir}/jar_lib/spring-web.jar:

        	${base.dir}/jar_lib/spring-webmvc.jar:

        	${base.dir}/jar_lib/standard.jar:

        	${base.dir}/jar_lib/commons-dbcp.jar:

        	${base.dir}/jar_lib/spring.jar:

        	${base.dir}/jar_lib/spring-jdbc.jar:

        	${base.dir}/jar_lib/commons-fileupload-1.2.1.jar:

        	${base.dir}/jar_lib/commons-collections.jar:

        	${base.dir}/jar_lib/jcommon-1.0.16.jar:

        	${base.dir}/jar_lib/jfreechart-1.0.13.jar:

        	${base.dir}/jar_lib/memcached_2.4.2.jar:

        	${base.dir}/jar_lib/je-4.0.71.jar:

        	${base.dir}/jar_lib/berkeleyDB.jar

        	${base.dir}/jar_lib/spring-modules-validation-0.7.jar"

         srcdir="${base.dir}/output_ui/src_ui" debug="on" failonerror="true"

         nowarn="off" memoryMaximumSize="256m" fork="true" executable="${jdk_home}/bin/javac">

        </javac>

    	

    	

    	<mkdir dir="${base.dir}/output_ui/class_ui/com/yht/i18n"/>

		<copyfile dest="${base.dir}/output_ui/class_ui/applicationContext.xml" src="${base.dir}/output_ui/src_ui/applicationContext.xml"/>

    	<copyfile dest="${base.dir}/output_ui/class_ui/com/yht/i18n/digit.properties" src="${base.dir}/output_ui/src_ui/com/yht/i18n/digit.properties"/>

    	<copyfile dest="${base.dir}/output_ui/class_ui/com/yht/i18n/entity.properties" src="${base.dir}/output_ui/src_ui/com/yht/i18n/entity.properties"/>

    	<copyfile dest="${base.dir}/output_ui/class_ui/com/yht/i18n/index.properties" src="${base.dir}/output_ui/src_ui/com/yht/i18n/index.properties"/>

    	<copyfile dest="${base.dir}/output_ui/class_ui/com/yht/i18n/product.properties" src="${base.dir}/output_ui/src_ui/com/yht/i18n/product.properties"/>

    	<copyfile dest="${base.dir}/output_ui/class_ui/com/yht/i18n/user.properties" src="${base.dir}/output_ui/src_ui/com/yht/i18n/user.properties"/>

    	<copyfile dest="${base.dir}/output_ui/class_ui/com/yht/i18n/err.properties" src="${base.dir}/output_ui/src_ui/com/yht/i18n/err.properties"/>

    	<copyfile dest="${base.dir}/output_ui/class_ui/com/yht/i18n/debugTool.properties" src="${base.dir}/output_ui/src_ui/com/yht/i18n/debugTool.properties"/>

    	<copydir dest="${base.dir}/jetty/lib" src="${base.dir}/jar_lib"></copydir>

    	<delete dir="${base.dir}/output_ui/www_ui/WEB-INF/lib"></delete>

    	<copyfile dest="${base.dir}/output_ui/class_ui/spring-servlet.xml" src="${base.dir}/output_ui/www_ui/WEB-INF/spring-servlet.xml"/>

    </target>

    

	

	

	

	<!--*******************************************create war**************************************************-->

    

    <target name="makewar">

        <war destfile="${base.dir}/jetty/webapps/app.war" webxml="${base.dir}/output_ui/web/web.xml">

            <classes dir="${base.dir}/output_ui/class_ui"/>

            <fileset dir="${base.dir}/output_ui/www_ui"/>

        </war>

    </target>

    

	<!--*******************************************commit war  to svn**************************************************-->

    

</project>


build .sh  
#!/bin/bash
rm -rf build
mkdir build
svn co svn://192.168.1.125/newclass4/branches/2.0final/UI/build/  --username wangxj --password 123456  ./build
cd build
/usr/src/apache-ant-1.7.1/bin/ant
cd ..
./start_jetty.sh

你可能感兴趣的:(apache,UI,ant,SVN,脚本)