使用svnant可以跟ant结合,在ant打包的时候可以先操作svn更新代码。
1)下载svnant-1.3.1
2)svnant-1.3.1\lib拷贝到ant\lib目录下
3)编写ant脚本build.xml
<?xml version="1.0" encoding="GBK"?>
<project name="NSTC" default="build.n6" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<tstamp prefix="now" />
<path id="svnant.lib">
<fileset dir="C:\ANT\lib">
<include name="svnant.jar"/>
<include name="svnClientAdapter.jar"/>
<include name="svnkit.jar"/>
<include name="svnant.jar"/>
<include name="jna.jar"/>
<include name="ganymed.jar"/>
</fileset>
</path>
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="svnant.lib"/>
<svnSetting id="svn.setting" svnkit="true" username="wangweifeng" password="w1234567" javahl="false" />
<target name="build.n6">
<antcall target="checkout"/>
</target>
<!--更新代码-->
<target name="updateCode">
<svn refid="svn.setting">
<update revision="HEAD" dir="E:\workspace\GDMS" />
</svn>
<echo message="update success!"></echo>
</target>
<!--检出-->
<target name="checkout">
<svn refid="svn.setting">
<checkout url="http://192.168.0.2/svn/repo/ProD/GDMS/trunk" revision="HEAD" destPath="E:\GDMS" />
</svn>
</target>
</project>