0

Accessing Subversion Using SvnAnt and JavaHL

Over the years, I've spent a lot of time with Ant and Subversion while using SvnAnt to make the pair sing in perfect harmony.  In the past, though, I've always had the Subversion client installed so SvnAnt just used that to communicate with my repositories.  Why not?  It's convenient.

I recently had occasion to install the happy trio again, however, and I decided to unclutter my file system by not installing the Subversion client.  I rarely use the command line client anymore in favor of TortoiseSVN, so there was no compelling reason to install it.  Instead, I decided I'd use the JavaHL library to connect to Subversion.  SvnAnt supports that connection method so I figured it would be relatively painless.

Um, no.

SvnAnt bundles the JavaHL library itself in a file named svnjavahl.jar, but it doesn't include the glue that makes it all stick together in a meaningful way - javahl.dll.  Not only isn't the dll file included, but it's not easy to find and download.  In fact, the only way I found to get my hands on it was to install Subclipse - a plugin that I don't need or use for the Eclipse IDE (which I do use).  After that, I had to copy the files I needed - javahl.dll and its far-too-many dependencies (DLL Hell, anyone?) - to somewhere in my %PATH% before I was finally able to export from Subversion using SvnAnt.

Installing Subclipse was pretty easy.  There are easy-to-follow instructions on the Subclipse project site complete with a lot of visual aids (read: screenshots).  Once I had Subclipse installed, I needed to copy the following files from <eclipse root>\plugins\org.tigris.subversion.javahl.win32_1.2.2\:

  • libsvnjavahl-1.dll
  • intl3_svn.dll
  • libeay32.dll
  • ssleay32.dll
  • libapr.dll
  • libaprutil.dll
  • libapriconv.dll
  • libdb44.dll

Whew.  That took a while.  I didn't know what the dependencies were (or even that there were any, really) so I had to try to execute my build after each file was copied and see what failed next.  I copied all of the required files to %ANT_HOME%/bin for convenience, but anywhere in your %PATH% will work just fine.  After copying all eight files, my build finally ran and happily went about its job of exporting my fileset from Subversion.

Now that I have this working, I think I'll do a bit more decluttering and remove Subclipse.  There has to be a better way to do this, but even after some fairly extensive quality time with Google I sure couldn't find it.  In lieu of a more, um, obvious method, this path at least got the job done.

tags:
Development
Mark Phippard said:
 
The best way to get standalone JavaHL is from Subversion itself.

http://subversion.tigris.org/servlets/ProjectDocum...

They provide a compiled version for Windows. You need two zip files. The main command line zip file (so that you have all of the DLL dependencies) and then the JavaHL zip file. Just unzip them to the same location and then move the JavaHL DLL to the "bin" folder with the rest of the SVN DLL's. Then put that folder on your PATH. You should also use the JAR file that is in their package so that the version matches the DLL.

Mark
 
posted 496 days ago
Add Comment Reply to: this comment OR this thread
 
 
Thanks, Mark. Doesn't this effectively install the command line client, though? Or am I misunderstanding you?

I don't know how I missed the JavaHL zip file when I was looking for it last night, but I did. Seeing it now, it looks like that particular zip file contains both the jar and the DLL files. Isn't that all I should need?

Thanks for the information. This is a lot more straightforward than my way. :-)
 
posted 496 days ago
Add Comment Reply to: this comment OR this thread
 
Mark Phippard said:
 
Yes it is essentially installing the command line client. You have to do that to get the dependent DLL's. These are not included in the JavaHL zip file. Only the JavaHL DLL is included.

If you have a problem over having the command line client installed, then just delete the .exe files from the bin folder.

I actually think it is probably easier to use the svn.exe from Ant then it is to use SvnAnt. Depending on your needs of course. SvnAnt will make it easier to do sophisticated scripts, but if you just need to get the code for a build, it is easier to just run the exe using the exec task.
 
posted 496 days ago
Add Comment Reply to: this comment OR this thread
 

Search

Rob  Wilkerson