Using SVN with ant

Source: Internet
Author: User

1 . Subversion OverviewIf you start by referencing Version Control with subversion:" If C gives you enough rope to hang yourself, think of subversion as a sort of rope storage facility. " -Brian W. FitzpatrickThen tell everyone that CVS is old love, and subversion is new love. The characteristics and advantages of several subversions are illustrated by the following. Take a look at how to use subversion and related client software on the Internet. Official free books are good. 2 Ant appearanceIn the latest project, the team used subversion as the version control tool. Daily build has to be built in two days. Go to ant! Tigris.org provides subclipse, svnclientadapter, and svnant. (See here) SubclipseIs an Eclipse plug-in that enables IDE and subversion integration; SvnclientadapterIt is a set of subversion Java APIs that encapsulate client access to subversion; SvnantIs an ant task used to access subversion. It depends on svnclientadapter. I want to use svnant, with SVN check out a svnant code: SVN Co http://subclipse.tigris.org/svn/subclipse/trunk/svnant/ svnant in this project also includes svnant ant task instructions, you can also view it directly here. After svnant is compiled using build. XML, svnant. jar is generated under the newly generated build subdirectory. Copy the svnclientadapter. jar and svnjavahl. Jar files in the lib directory of the svnant. jar and svnjavahl. Jar files to the ant directory. Then write the following ant script for testing: <? XML version = "1.0"?> <Project name = "SVN ant test" default = "checkout" basedir = "."> <! -- 1 --> <property name = "remote. url"

Value = "SVN: // 16.157.xxx.xxx/trunk/lnportal/src/p3uipadapter/"/> <property name = "Local. dir" value = "local"/> <! -- 2 --> <taskdef name = "SVN" classname = "org. tigris. subversion. svnant. svntask "/> <target name =" prepare "Description =" Prepare the dirs for other tasks "> <Delete dir =" $ {local. dir} "/> <mkdir dir =" $ {local. dir} "/> </Target> <! -- 3 --> <target name = "checkout" depends = "prepare"> <SVN javahl = "true" username = "lihq" Password = "password"> <checkout url =" $ {remote. URL} "destpath =" $ {local. dir} "/> </SVN> </Target> </Project> 3. Launch of objective VN

The execution of svnant depends on svnclientadapter, and there are two ways to access SVN: One is through the svn command line program (I am wondering: If so, it is better to use the ant exec task); the second is to execute it through javahl. Javahl is a Java interface used to access subversion (estimated as JNI). This requires svnjavahl. dll on Windows. The daily build of the team is not windows, so I asked for release VN, which is a pure Java SVN solution. Please visit this Guide: Making svnant use unique VN. The actual steps are as follows: Step 1 :Remove svnclientadapter. jar from the lib directory of ant. I didn't find javahl. jar, So I removed svnjavahl. Jar. In fact, it doesn't matter if I moved the latter; Step 2 :Download unzip VN. jar and javasvn-javahl.jar on that page, and the svnClientAdapter-0.9.32.jar for unzip VN. Copy the Three jar files to the ant lib directory, and run the svn ant test script written above. The result is as follows :... Build failedjava. lang. abstractmethoderror: Org. tigris. subversion. svnant. feedback. logrevision (j) vtotal time: 7 seconds although all SVN code is removed, ant will throw the above error, which makes the ant script unable to run subsequent tasks. 4 . Thanks Open SourceIt seems that probably because of the change of svnant to invoke with its own svnClientAdapter-0.9.32.jar. Svnant (by tigris.org) originally called svnjavahl. jar to run the svn command. After replacing the svnClientAdapter-0.9.32.jar, svnant (plus cmdvn) calls the javasvn-javahl.jar and cmdvn. jar to run the svn command. The above error is probably caused by inconsistent definitions of an abstract method by the two sets of svnclientadapter. It is estimated that the problem is caused by the corresponding API version. Solution: First, check the source code of svnant. jar and find that org. Tigris. subversion. svnant. Feedback is an interface called isvnpolicylistener in svnclientadapter. jar. The definition of the error-returned logrevision method in this interface is: public abstract void logrevision (long revision, string path) and the definition of the interface for viewing isvnpolicylistener in the svnClientAdapter-0.9.32.jar is: public abstract void logrevision (long Revision) obviously does not match, so svnant is modified. jar source code, modify Org. tigris. subversion. svnant. feedback, as shown in the following method: // This method is added by beegeepublic void logrevision (long Revision) {}// this method is the original one by svnantpublic void log Revision (long revision, string path) {} and re-compile svnant to generate svnant. jar, copy and replace the jar with the same name under the lib directory of ant, and re-run the above SVN ant test script. The result is as follows: OK! -End-

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.