SVN Ant Update example

2019-04-11 05:16发布

I'm quite new in Ant and i want to make an SVN Update operation. I add the jar files into the ant/lib folder, also i add the typedef property in my build.xml file.

<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpath="ant/lib/svnant.jar;ant/lib/svnClientAdapter.jar;ant/lib/svnkit.jar;ant/lib/svnjavahl.jar" />

But now I need some code example for making update from repository at one folder (let's say the folder name is test) I look over internet but a few examples are provided with this svn ant call.

I've tried something like this

<target name="svn-update">
    <svn username="test" password="*****">
        <update revision="HEAD" dir="com.project.blackbox.eclipse" />
    </svn>
</target>

标签: svn ant
3条回答
闹够了就滚
2楼-- · 2019-04-11 05:51

I think it should work if you use path delimiters in the dir attribute:

<svn username="test" password="*****">
    <update revision="HEAD" dir="${basedir}/com.project.blackbox.eclipse" />
</svn>

There should be nothing special with the update command. You just have to make sure that you are using the correct directory and it have to be a svn working copy.

查看更多
成全新的幸福
3楼-- · 2019-04-11 05:52

You have the typedefs right.

What you are trying to do is update to a directory which wasn't checked out by SVN. This means that your likely have the wrong directory in your "dir" attribute.

If your "dir" attribute points to the project's root directory, odds are it is wrong. You likely checked out to a "src" folder under the project's root directory.

Look in the Project's root directory (typically it is under the Workspace "root" directory, in a directory with the same name as the project). Look for any subdirectories that contain a ".svn" hidden directory. Odds are you only checked out from one repository, so if that's true then the first one you find will likely be the directory you meant to include in the "dir" directive.

If you have multiple directories to select from, at the command line do a "svn info ." for each candidate directory and you will soon be able to sort them out.

查看更多
再贱就再见
4楼-- · 2019-04-11 06:04

Here is a simple solution mate:

Requirement:

tortisesvn version - 1.7
subversuin version - 1.7
Ant version - 1.8 

Make sure you checkout with with new version of tortisesvn client. 

<!-- Execute svn update command -->
<target name="fetch-update-code" description="Fetches update code from base/current working repository" >
    <exec executable="svn" dir="D:/opt/trunk" spawn="false">
        <arg value="update" />
        <arg value="--username=${svn.username}" />
        <arg value="--password=${svn.password}" />
    </exec>
</target>


 Hope this helps: 
查看更多
登录 后发表回答