Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
744 views
in Technique[技术] by (71.8m points)

ant - The svn client 'svnkit' is not available

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.

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).

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" />

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>

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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>

Note:

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...