用ant实现SVN代码更新,部署
来源:互联网 发布:python 技术指标 编辑:程序博客网 时间:2024/04/30 13:30
要实现ant可以从svn服务器上检出代码要使用svnant jar文件。
从网上下载svnant 包,下载地址:
http://subclipse.tigris.org/files/documents/906/49042/svnant-1.3.1.zip
将下载好的svnant 解压将 lib目录下的所有jar复制到ant主目录中的 lib目录下。
编写build.xml
要svn task任务可以使用要在build.xml中添加
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" />
完整的xml文件如下:
<project name="dt" basedir="."> <!--定义属性--><property name="src" value="src/main/java" /><property name="resources" value="src/main/resources"/><property name="test" value="test"></property><property name="target" value="target"></property><property name="main-target" value="target/classes"/><property name="test-target" value="target/test-classes"/><property name="lib-dir" value="WebContent/WEB-INF/lib"/><property name="tomcat.home" value="D:/webapp-server/apache-tomcat-6.0.20"/><!--ant lib目录><property name="ant-lib-dir" value="D:/apache-ant-1.8.2/lib"/><!-- 需指向本地tomcat lib目录 --><property name="tomcat-lib" value="D:/webapp-server/apache-tomcat-6.0.20/lib"/><!-- svn路径 --><property name="urlRepos" value="svn://192.168.1.1o/Project/dt" /><!-- 定义classpath--><path id="classpath"><fileset dir="${lib-dir}" includes="***.jar"></fileset><fileset dir="${tomcat-lib}" includes="***.jar"></fileset></path><!-- 引用svn task文件,使用svn任务可以使用--><typedef resource="org/tigris/subversion/svnant/svnantlib.xml" /><!-- 清理--><target name="clean"><delete dir="${target}"></delete></target><!-- 初始化--><target name="init" depends="clean"><mkdir dir="${main-target}"/><mkdir dir="${test-target}"/></target><!-- 设置svn相关属性 --><svnSetting id="svn.setting" svnkit="true" username="hzl" password="111111" javahl="false" /><!-- 检出代码 这里使用 export 不是checkout 二者区别 checkout会svn相关信息文件检出,export只是检出最新的文件--><target name="checkout" depends="clean"><svn refid="svn.setting"><export srcUrl="${urlRepos}" destPath="." force="true"/></svn></target><!-- 编译 --><target name="compile" depends="checkout"><javac srcdir="${src}" destdir="${main-target}" encoding="UTF-8" includeAntRuntime="false"><classpath refid="classpath"></classpath></javac><copy todir="${main-target}"><fileset dir="${resources}"><exclude name="sql/**"/></fileset></copy></target><!-- 打war包 --><target name="build" depends="compile"><war destfile="${target}/dt.war" webxml="WebContent/WEB-INF/web.xml"><fileset dir="WebContent"></fileset><classes dir="${main-target}"></classes></war><delete dir="${main-target}"></delete><delete dir="${test-target}"></delete></target> <!--shutdowntomcat--> <target name="shutdowntomcat" description="========shutdowntomcat==========="> <exec executable="${tomcat.home}/bin/shutdown.sh" failonerror="false"></exec> <sleep seconds="10"/> </target> <!--startuptomcat--> <target name="startuptomcat" description="========startuptomcat==========="> <sleep seconds="5"/> <exec executable="${tomcat.home}/bin/startup.sh" failonerror="false"></exec> </target> <!--部署到tomcat下面--> <target name="deploy" depends="war"> <copy file="${target}/dt.war" todir="${tomcat.home}/webapps" /> </target></project>
0 0
- 用ant实现SVN代码更新,部署
- linux服务器下用ant实现SVN代码更新,部署
- 【antsvn】linux服务器下用ant实现SVN代码更新,部署
- linux服务器下用ant实现SVN代码更新
- 用SVN+Ant实现基于产品的项目代码管理
- 使用ANT+SVN在Linux上实现自动部署项目
- SVN+ANT实现远程Java WEB应用的更新
- ant + svn 自动部署项目
- jenkins 部署ant+weblogic+svn
- ant实现自动化部署
- Linux CentOS SVN 设置钩子hooks/post-commit来同步更新服务器web目录,实现代码自动部署
- sinaapp上用svn进行代码部署
- 一键部署项目,svn+ant+jetty
- jenkins svn tomcat ant自动部署
- ant+svn检出并部署项目
- jenkins svn tomcat ant自动部署
- jenkins svn tomcat ant自动部署
- Linux服务器下Jenkins+Ant+Tomcat+SVN实现持续集成和部署配置方法
- K近邻分类算法实现 in Python
- 在虚拟机(centos)配置postgresql数据库(1) - 安装篇
- 简化文件的绝对路径 Simpify Path
- C++ traits和enable_if的实现
- HDU4539
- 用ant实现SVN代码更新,部署
- apache虚拟主机
- OGNL表达式和EL表达式
- ortp库API说明
- MyEclipse去掉debug模式
- Unity学习(二):一些游戏开发中的术语(未完待续)
- [博弈]HDU 2509 Be the Winner
- C++调用gSoap编写的WEBSERVICE与C#.NET间接口自定义结构体不能重复使用
- 从Jetty、Tomcat和Mina中提炼NIO构架网络服务器的经典模式