How to Integrate Subversion, Version Control Software, With Apache ANT如何整合颠覆,版本控制软件,与Apache蚂蚁
Subversion is a popular version control software and replacement for CVS, the grand-daddy of all version control software which is still widely used in open source community.颠覆罪是一个热门的版本控制软件和更换为个人简历,大-爸爸的所有版本控制软件仍然是广泛使用的开放源代码社区。
Recently I had the necessity to invoke Subversion commands like checkout from Ant, a popular java based build software which replaces make tool.最近,我有必要引用颠覆命令一样,结帐从蚂蚁,一个受欢迎的以Java为基础建立的软件取代,使工具。
There are two ant tasks to accomplish this, the better one is SvnAnt from Subclipse project.有两个蚂蚁任务,要做到这一点,更好地之一,是svnant从subclipse项目。 However configuring it to work was non-trivial as proper usage documentation was missing.不过,配置它的工作是不平凡的作为正确使用文件失踪。 So I decided simplify the process to make your life easier.所以我决定简化程序,使您的生活更轻松。
However the extensive commands it supports are well然而,广泛的命令,它支持良好 documented记录 . 。
Note: If prompted for user name / password use guest / guest.注意:如果提示用户名/密码使用客户/客户。
Why SvnAnt?为什么svnant ?
Subversion is a full-fledged version control software obviously supporting commands like checkout, add or commit.颠覆罪是一个完全成熟的版本控制软件显然是支持的命令一样,结帐,添加或承诺。 The ant task from O’Reily didn’t even support checkout!蚂蚁的任务从o'reily甚至没有支持结帐! It supported a very limited set from the available commands.它支持一个非常有限的一套从可用的命令。
So I went for所以我去 svnant task which had much better support.任务有很大的更好的支持。 Also this way you don’t have to mess with也通过这种方式,您不须一塌糊涂,与 exec’ing the Subversion CLI exec'ing颠覆的CLI commands directly from your ant script.命令直接从您的蚂蚁脚本。 It is wrapped up for ease of use.这是结束了为便于使用。 It can also use JNI interface for speed.它也可以使用jni接口的速度。
To provide access to the Subversion API, svnant uses either the提供进入颠覆空气污染指数, svnant用途,无论是 javahl - Subversion Java bindings or Subversion’s command line programs (which must be installed and in your PATH). -颠覆的J ava绑定或颠覆罪的命令行程序(必须安装并在您的路径) 。
javahl uses JNI which must be setup appropriately. javahl使用jni必须安装适当的。 I preferred using the Subversion’s command line programs as subversion was already installed in my system. i推荐使用颠覆的命令行程序作为颠覆已经安装在我的系统。
Steps:步骤:
1. 1 。 I am assuming you already have我假设您已经有 ant蚂蚁 installed.安装。 If not do it first.如果不能这样做第一。 Ensure %ANT_HOME% ($ANT_HOME for *nix) is defined and %ANT_HOME%\bin is appended to your %PATH%.确保% ant_home % (元ant_home为* nix中)的定义和% ant_home % \斌是附加到您的%路径% 。
2. 2 。 If you do not have subversion installed then first如果您没有颠覆安装,然后第一 download it下载 and install.并安装。
2.1 Ensure that svn is in your path by invoking svn from a command windows (cmd for windows, bash etc. for *nix). 2.1确保svn是在您的路径引用svn从命令窗口( cmd用于Windows ,在bash等* nix中) 。
3. 3 。 Download下载 svnant and extract the files to any directory.和文件提取到任何目录。
4. 4 。 Go to your project directory.转到您的项目目录。 If it doesn’t have a lib (or equivalent) directory to store required jar files then create one and copy all the files (*.jar ) from svnant’s lib directory:如果没有一个库(或同等学历) ,目录商店所需的jar文件,然后创建一个和所有文件复制( *.罐)由svnant的库目录:
commons-lang-2.0.jar商品郎2.0.jar
jakarta-regexp-1.3.jar雅加达- regexp的- 1.3.jar
svnClientAdapter.jar svnclientadapter.jar
svnant.jar
svnjavahl.jar
5. 5 。 To use svn task you have to add a taskdef to your build file.使用svn任务,你必须添加一个taskdef到您建立档案。 Use either of the following:使用下列任一:
Option 1:备选方案1 :
This requires the lib directory to be included with either “ant -lib lib” or by adding an extra parameter:这需要的lib目录中列入无论是“蚂蚁库库”或新增了额外的参数:
where project.classpath is previously defined as:凡project.classpath是以前的定义为:
Option 2 is simpler:方案2是简单的:
The project.classpath is previously defined as shown before.该project.classpath是先前定义显示之前。
For example you can use this simple build.xml file to fetch latest code from WordPress repository:例如,您可以使用这个简单的build.xml文件撷取最新的代码存放在WordPress :
Run this script by simply typing ant.运行此脚本,只需输入蚂蚁。
BTW: I think Subversion as version control software and ant as build and deployment software are two very strong products which should be part of any enterprise open source software stack.的BTW :我认为颠覆作为版本控制软件和蚂蚁作为建立和部署软件是两个非常强烈的产品应的一部分,任何企业开放源码软件堆栈。
Filed under提起下 Headline News头条新闻 , , How To如何 , , Java Software Java软件 , , Open Source Software开放源码软件 , , Tech Note技术说明 | |
| |
RSS 2.0 2.0 | |
Trackback Trackback跟踪 this Article |此文章|
Email this Article电子邮件此文章
You may also like to read您也可以想读 |




































June 9th, 2006 at 1:09 pm 2006年6月9日在下午1时09分
I am not able to set the interative option in svn, ie I have to use username and password option in a non interactive way.我不能设置互动选项, svn ,即我必须使用用户名和密码,选择在一个非互动的方式。
Can anyone tell the format to enable authentication in an interactive way.任何人都可以告诉格式,使认证在一个互动的方式。
Thanks in advance.感谢在前进。
Ankush安库什
May 3rd, 2007 at 10:18 am 2007年5月3日在上午10时18分
Ankush, if it is not too late安库什,如果现在还为时不晚
There is an task for this purpuse in Core taskset.有一个任务,这purpuse在核心taskset 。 See example:见例如:
Flitt flitt
May 20th, 2008 at 2:48 pm 2008年5月20日在下午2时48分
I find the SVN Ant task very primitive compared to its CVS cousin.我觉得svn蚂蚁的任务非常原始的相比,其CVS的表姐。 Maybe I’m missing something but I couldn’t figure out how to replace this cvs task with its svn alternative:也许我失踪的东西,但我无法弄清楚如何以取代这个CVS的任务,其svn替代:
<cvs dest=”${dest}”<个人简历dest = “ $ ( dest ) ”command=” ${command} “指挥= “ $ (命令 ) ”tag=”${tag}”标记= “ $ ( tag ) ”吗package=” ${packages} “包= “ $ (包 ) ”output=”${output}”>输出= “ $ (输出) ” >May 20th, 2008 at 2:59 pm 2008年5月20日在下午2时59分
I find the SVN Ant task very primitive compared to its CVS cousin.我觉得svn蚂蚁的任务非常原始的相比,其CVS的表姐。 Maybe I’m missing something but I couldn’t figure out how to replace the cvs task with its svn alternative.也许我失踪的东西,但我无法弄清楚如何取代CVS的任务,其svn替代。 I’m referring to the ‘command’ and ‘package’ attributes which could be specified as build properties and would make the build script pretty generic and parameterized.我所指的'指挥'和'包'的属性可以被指定为建立性能,并会作出建立脚本漂亮的通用和参数。