本文介绍了svn客户端“svnkit”不可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用svnant 1.3.0创建从我的SVN仓库分支标签。现在,我已经升级,从SVN 1.6〜1.7,并有支持它没有公布svnant二进制文件。但我从tigris.org下载svnant 1.4源代码,并建立一个svnant.jar。

I have been using svnant 1.3.0 to create tags from branches in my SVN repository. Now I have upgraded from SVN 1.6 to 1.7 and there is no released svnant binary that supports it. But I have downloaded the svnant 1.4 source from tigris.org and build a svnant.jar.

我知道svnant有几个依赖条件,我有以下几点:svnkit 1.7.5(从svnant库),svnjavahl(从svnant库),svnClientAdapter(从svnant库),svnkit-CLI(从svnant库) trilead-SSH 1.0(从Maven仓库)和ganymed-ssh.jar建立210(从Maven仓库)。

I know that svnant has a few dependecies and I have the following: svnkit 1.7.5 (from svnant repository), svnjavahl (from svnant repository), svnClientAdapter (from svnant repository), svnkit-cli (from svnant repository), trilead-ssh 1.0 (from maven repository) and ganymed-ssh.jar build 210 (from maven repository).

我用IVY的依赖管理和添加了所有上述罐(除两个来自Mav​​en仓库)到我的Artifactory的安装。在我的IVY依赖文件检索到罐子像这样:

I use IVY for dependency management and have added all the above jars (except for the two from maven repository) to my Artifactory installation. In my IVY dependency file I retrieve the jars like so:

<dependency org="svnant" name="svnant" rev="1.4.0" conf="test->default" />
<dependency org="svnkit" name="svnkit" rev="1.7.5" conf="test->default" />
<dependency org="svnjavahl" name="svnjavahl" rev="1.4.0" conf="test->default" />
<dependency org="svnClientAdapter" name="svnClientAdapter" rev="1.4.0" conf="test->default" />
<dependency org="svnkit-cli" name="svnkit-cli" rev="1.7.5"/>
<dependency org="trilead-ssh2" name="trilead-ssh2" rev="1.0.0" conf="test->default"/>
<dependency org="ch.ethz.ganymed" name="ganymed-ssh2" rev="build210" conf="test->default" />

所有罐子正确检索。我尝试做一个branch2tag副本像这样(的retrieveIVY目标检索上述jar文件):

All jars are retrieved correctly. I try to do a branch2tag copy like so (The retrieveIVY target retrieves the jar files described above):

<target name="create-tag" depends="retrieveIVY">
    <taskdef classpathref="test.classpath.dep" resource="net/sf/antcontrib/antcontrib.properties" />
    <typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="test.classpath.dep" />
    <echo message="Creating tag ${env.tag_name}" />
    <svnSetting username="${user}" password="${password}" client="svnkit" />
    <svn>
        <copy srcUrl="[srcUrl]" destUrl="[destUrl]" message="${env.tag_name}" />
    </svn>
</target>

这曾与svnant 1.3.0和SVN 1.6(除了svnSetting标签)。但是,使用新的jar版本我收到以下错误:

This worked with svnant 1.3.0 and SVN 1.6 (apart from the svnSetting tag). But using the new jar versions I get the following error:

The svn client 'svnkit' is not available !
at org.tigris.subversion.svnant.SvnClientType.checkAvailability(SvnClientType.java:122)
at org.tigris.subversion.svnant.SvnClientType.createClient(SvnClientType.java:93)
at org.tigris.subversion.svnant.SvnFacade.getClientAdapter(SvnFacade.java:362)
at org.tigris.subversion.svnant.SvnTask.executeImpl(SvnTask.java:597)
at org.tigris.subversion.svnant.SvnTask.execute(SvnTask.java:568)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:392)
at org.apache.tools.ant.Target.performTasks(Target.java:413)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:424)
at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:138)
Caused by: org.tigris.subversion.svnclientadapter.SVNClientException: SVNKit client adapter is not available
at org.tigris.subversion.svnclientadapter.svnkit.SvnKitClientAdapterFactory.setup(SvnKitClientAdapterFactory.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.tigris.subversion.svnant.SvnClientType.invoke(SvnClientType.java:129)
at org.tigris.subversion.svnant.SvnClientType.checkAvailability(SvnClientType.java:112)
... 19 more

是否有人有可能解决这个问题的想法?

Does someone have an idea that could solve this problem?

推荐答案

我会建议直接使用 java类而不是与任务挣扎。这种方法,将具有一个macrodef相结合,将导致类似但更可靠的解决方案。

I would advise using the svnkit java classes directly instead of struggling with the svnant task. This approach, combined with a macrodef, will result in a similar but more reliable solution.

<project name="build" default="checkout" xmlns:ivy="antlib:org.apache.ivy.ant">

    <!--
    ======
    Macros
    ======
    -->
    <macrodef name="svn-checkout">
        <attribute name="src"/>
        <attribute name="dest"/>
        <sequential>
            <mkdir dir="@{dest}"/>
            <java classname="org.tmatesoft.svn.cli.SVN" dir="@{dest}" fork="true" classpathref="build.path">
                <arg value="--non-interactive"/>
                <arg line="--username ${svn.user}"/>
                <arg line="--password ${svn.pass}"/>
                <arg value="checkout"/>
                <arg value="@{src}"/>
            </java>
        </sequential>
    </macrodef>

    <!--
    =======
    Targets
    =======
    -->
    <target name="resolve" description="Resolve 3rd party dependencies">
        <ivy:cachepath pathid="build.path">
            <dependency org="org.tmatesoft.svnkit" name="svnkit-cli" rev="1.7.8" conf="default"/>
        </ivy:cachepath>
    </target>

    <target name="checkout" depends="resolve" description="Pull code from SCM repository">
        <svn-checkout src="http://svn.apache.org/repos/asf/subversion/trunk" dest="build/subversion"/>
    </target>

    <target name="clean" description="Cleanup build files">
        <delete dir="build"/>
    </target>

    <target name="clean-all" depends="clean" description="Cleanup and purge ivy cache">
        <ivy:cleancache/>
    </target>

</project>

请注意:


  • 本例使用常青藤任务下载依赖关系称为build.path本地类路径参考。

  • This example uses the ivy cachepath task to download the dependencies into a local classpath reference called "build.path".

这篇关于svn客户端“svnkit”不可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-01 15:25