After having problems with JavaSVN, I ended up having to use JavaHL. In Ubuntu (and probably other distros), this takes a bit of effort to set up. Read on for how I made a .deb package for JavaHL.
---UPDATE: The instructions in this entry are no longer necessary in Dapper, as they now have a JavaHL package. Just install "libsvn-javahl" then make sure you add the following to your Eclipse launcher parameters:
-vmargs -Djava.library.path=/usr/lib/jni
Note that the JavaHL library is stored in /usr/lib/jni, which is different than what happens with the custom package I had described in this entry.
Also, see comments below if you are having problems with this.
---
I recently switched from CVS to SVN for my personal projects. I saw a lot of major open source projects making the switch, so I figured its safe enough. I'm the only user of my repositories, but I occasionally do work on the same projects from multiple computers.
One of the important factors for me is the Eclipse plugin. The CVS support in Eclipse is so excellent that I would have to have something that matches it for the switch to be worth it. And Subclipse may just be good enough to match it.
After some problems getting JavaHL library to work with Subclipse (while I was using Debian sid), I gave up and used the JavaSVN library. It worked fine while I worked on the same computer. When I finally tried working off another computer, and synchronizing the changes back on my Linux machine, things became difficult. The other computer is running Windows and using the JavaHL library (appears to be installed out-of-box). When I went back to my Linux machine (now I had switched to Ubuntu) to synchronize, it would take a very long time to finish the synchronize, and then it would not pick up all the changes I made (they were in the repository, but it was not recognizing them). The problems were bad enough that it became unusable (I was even considering switching back to CVS), so I decide to try to install the JavaHL package.
Unlike Debian sid, Ubuntu doesn't have a javahl package. So I found this wiki page which helped me figure out how to do it. Some of the information from that page I am quoting here (with some modificatons).
As a normal user, I retrieved the subversion source code:
apt-get source subversion
Entered the subversion directory (I'm using 1.2.0 here)
cd subversion-1.2.0
Edited the file debian/rules and change:
ENABLE_JAVAHL=no
to:
ENABLE_JAVAHL=yes
Search for the string "with-jdk" and make sure it points to your JDK home directory, mine looks like this:
confflags += --enable-javahl --without-jikes --with-jdk=/usr/lib/j2sdk1.5-sun
Now build the package (this will take quite a while):
fakeroot dpkg-buildpackage
If you get an error for missing dependencies, install all the packages it says to install. Also, install "gcc cpp g++" packages if you don't already have them (I had a fresh system, so I didn't).
I chose to make a Debian package for this, since if I don't, I'd probably forget that I copied files into the /usr directory. Now you can either copy the debian/libsvn-javahl directory somewhere or work on it directly. In the libsvn-javahl directory, create a directory called "DEBIAN":
mkdir libsvn-javahl/DEBIAN
I'm not sure if the following command is necessary, but if you get errors later you may want to try it:
find ./debian -type d | xargs chmod 755
Then created a file libsvn-javahl/DEBIAN/control that looks like this:
Package: libsvn-javahl Version: 1.2.0 Section: Development Priority: optional Architecture: i386 Depends: subversion (>= 1.2.0) Maintainer: Nilesh Kapadia Description: javahl library for Subversion
"ldconfig" needs to run after an install, and probably after an uninstall, so I created a file libsvn-javahl/DEBIAN/postinst (for post-install):
#!/bin/sh set -e echo "Executing ldconfig" ldconfig
and libsvn-javahl/DEBIAN/postrm (for post-remove):
#!/bin/sh set -e echo "Executing ldconfig" ldconfig
Now we are ready to build the Debian package:
dpkg-deb --build libsvn-javahl
Now, as root (everything up to now was as a normal user), install the package:
dpkg -i libsvn-javahl.deb
Add the following to the Eclipse command line in your launcher:
-vmargs -Djava.library.path=/usr/lib
Now run Eclipse and switch the Subclipse setting to JavaHL (if its not set already). You shouldn't get any errors about missing libraries. I recommend retrieving a fresh copy from the repository if you were using JavaSVN before, I still had problems until I did that.
My problem in Debian sid may have been that I didn't change the Eclipse command line to point to /usr/lib.
Comments
Thanks
Awesome post! I was having trouble using the (SVNKit (Pure Java) [was getting RSA premaster secret errors for PROPFIND] under Team->SVN) and this solved my issue although I did have to cp the libs to /usr/lib as it was not picking up the new /usr/lib/jni I supplied
Addition concerning Edgy Eft
Hello everyone,
I used the previous advice here and it worked perfectly on Dapper. When upgraded to Edgy, it didn't work. I tried both ways and both failed me. Apparently this is a known issue, which would be fixed in due time. A dependency problem.
As shown below
https://launchpad.net/ubuntu/+source/subversion/+bug/62748
If you downgrade the packages mentioned there by Max (Down below) works perfectly well, adjoined with the advice mentioned here (Updated advice).
Hope it helps someone :) (I know it took me a while to find that bug notice!).
Thanks for posting that
Instead of downgrading, I tried patching apache2 as discussed on the issue page, and JavaHL is working again. I had to apply the patch manually (adding -D_XOPEN_SOURCE=500 to the end of one line).