The svn client 'svnkit' is not available
Asked Answered
J

1

2

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?

Jorie answered 30/4, 2013 at 17:4 Comment(0)
L
6

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".
Lemkul answered 30/4, 2013 at 23:0 Comment(2)
Thanks for your answer. I have a follow-up question. Does a checkout give the same result (for dest) in the repository as a svnant copy operation?Jorie
Thank you very much for your help. I changed your example to use the copy command and it works.Jorie

© 2022 - 2024 — McMap. All rights reserved.