ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mitch Gitman" <mgit...@gmail.com>
Subject not an Ivy problem per se—Subversion client Ant tasks
Date Fri, 28 Nov 2008 20:58:43 GMT
I've been wanting to incorporate some minimal Subversion interaction into my
build script. To do so, I've been trying to get my build script to invoke
the *svn *Ant task in the SvnAnt antlib.
SvnAnt<http://subclipse.tigris.org/svnant/svn.html>is a sub-project of
the
Subclipse <http://subclipse.tigris.org/svnant/svn.html> Eclipse plugin on
Tigris.org.

Set aside for now the question, "Why don't you try some other Subversion
client Ant library?" Indeed, I will, although I want to understand what's
going on with this library first.

Also set aside for now the question, "Why don't you ask about this on those
projects' mailing list(s)?" Indeed, I will, although I think this is a
legitimate question from an Ivy perspective and the communications I've seen
in the Subclipse community have been cryptic enough that I'm not holding out
much hope there.

I'm trying to use SvnAnt without Subclipse—or for that matter even without
Eclipse being installed. You see, this script would be invoked only on a CI
build server, so it doesn't need an IDE. Beyond that, even if I did have
Eclipse installed, Eclipse 3.4 now comes with another Subversion client,
Subversive, built-in.

I have an Ivy module that publishes three JARs:

   - svnant.jar
   - svnjavahl.jar
   - svnClientAdapter.jar

However, whenever I tried to run the *svn *Ant task with these JARs, I got
this error message:
Cannot use javahl nor command line svn client

Why was I getting this? Eventually, I figured out that what's unusual about
SvnAnt, or any Subversion client, is that accessing Subversion requires
native libraries. That error message was an indication that those native
libraries were not available.

There are two options for making those native libraries available, I
learned:

   - JavaHL: A DLL on Windows. In the svn Ant task, specify javahl="true"
   (the default).
   - The Subversion command line: An EXE on Windows. In the svn Ant task,
   specify javahl="false".

First I tried the JavaHL route. There's supposed to
be<http://notetodogself.blogspot.com/2006/08/cannot-use-javahl-nor-command-line-svn.html>some
mysterious javahl.dll or svnjavahl.dll, but I could never find that on
Tigris.org.

Then I tried the Subversion command line route. I downloaded the CollabNet
Subversion command line
client<http://www.collab.net/downloads/subversion/svn1.4.html>for
Subversion 1.4.6, added the root directory to my path (and restarted),
and set javahl="false".

And yet, I still got the error message:
Cannot use javahl nor command line svn client

So I did some more research and came across another option, an adapter
called SVNKit <http://svnkit.com/> from TMate Software. (In fact, the
Subversive plugin that's now part of Eclipse Ganymede uses SVNKit behind the
scenes.) There happens to be an instructions page, "Making SvnAnt use
JavaSVN."<http://svn.svnkit.com/repos/svnkit/branches/0.9.0/www/svnant.html>(On
Firefox, this page was always showing up for me as source. It presents
as markup on IE.)

That page recommends replacing the svnClientAdapter.jar and using it in
combination with an SVNKit javasvn.jar. I'll give that a shot, and I'm kinda
hopeful that will work. But first, I want to share a workaround that I was
able to get working.

What I did was, I kept in my ivy.xml the dependencies on my svnant Ivy
module with the three JARs, but then in addition I put those three JARs and
the SVNKit javasvn.jar in my *USER_HOME*/.ant/lib directory. Some of you
might recall *USER_HOME*/.ant/lib is a special directory that makes
libraries available to Ant's "coreloader" in Ant
1.6.x<http://ant.apache.org/faq.html#delegating-classloader-1.6>—never
mind that I happen to be using Ant 1.7.1.

Here's the bulk of the bare minimal Ant script with which I was able to get
this to work:
  <target name="shortcut-resolve-svn-taskdefs" depends="init-properties">
    ...
    <ivy:settings id="ivy.instance" url=".../ivysettings.xml" />

    <ivy:resolve file="ant-ivy.xml" conf="default"/>
    <ivy:cachepath pathid="classpath.svn.taskdefs" conf="default" />
  </target>

  <target name="svn-checkout" depends="shortcut-resolve-svn-taskdefs">
    <taskdef uri="antlib:org.tigris.subversion.svnant"
resource="svntask.properties" classpathref="classpath.svn.taskdefs" />

    <svn:svn javahl="true" username="..." password="...">
      <svn:checkout url="..." destPath="..." />
    </svn:svn>
  </target>

What's so mystifying is that the three JARs for SvnAnt need to wind up in
two places: both in *USER_HOME*/.ant/lib and in the Ivy cache. And in the
one location (.ant/lib), they need to coexist with the SVNKit javasvn.jar.
Anything short of the three JARs in one location and four JARs in the other,
and things won't work.

If there's anyone still reading this far, perhaps someone has an explanation
for the behavior I'm seeing. And perhaps someone can offer their own simpler
way to get SvnAnt working without Subclipse. And yes, I will try "Making
SvnAnt use JavaSVN." Thanks. And hey, if there are some Subversion Ant tasks
you've had a better experience with, I'd be happy to hear.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message