How to use SVN 1.8 with Eclipse

In this post I’m using Subclipse. I am not too sure whether you’d have the same problem with Subversive or whether it can be fix in the same way. Also I am working on a Mac. Of course the actual solution to this problem is not Mac OS X specific but would also work with Linux. So if you are using Eclipse and Subversion, just ignore the Mac specifics (e.g. Homebrew) and keep reading.

I installed subversion 1.8 using Homebrew some time ago but Eclipse kept using the old svn version so I didn’t have to upgrade my working copies. Now I tried to update a working copy from the command line (it contains documents and not code. That’s why I didn’t do it in Eclipse) and saw that I hadn’t upgraded it yet:

$ svn up
svn: E155036: Please see the 'svn upgrade' command
svn: E155036: The working copy at '/Users/henribenoit/workspace/kanban'
is too old (format 29) to work with client version '1.8.0 (r1490375)' (expects format 31). You need to upgrade the working copy first.

No big deal, I just upgraded all working copies:

$ svn upgrade

Now I could update them:

$ svn up
Updating '.':
At revision 303.

But now I couldn’t synchronize the working copies with the repository using Eclipse any more because eclipse was using the old svn version:

Problems reported while synchronizing SVNStatusSubscriber. 0 of 1 resources were synchronized.
An error occurred synchronizing /kanban: Error getting status for resource P/kanban org.apache.subversion.javahl.ClientException: svn: E155021: This client is too old to work with the working copy at
‘/Users/henribenoit/workspace/kanban’ (format ’31’).
Error getting status for resource P/kanban org.apache.subversion.javahl.ClientException: svn: E155021: This client is too old to work with the working copy at
‘/Users/henribenoit/workspace/kanban’ (format ’31’).
org.apache.subversion.javahl.ClientException: svn: E155021: This client is too old to work with the working copy at
‘/Users/henribenoit/workspace/kanban’ (format ’31’).
org.apache.subversion.javahl.ClientException: svn: E155021: This client is too old to work with the working copy at
‘/Users/henribenoit/workspace/kanban’ (format ’31’).

Actually I had already installed subversion 1.8 but I didn’t install it with the Java language bindings (which I did when I installed svn 1.7). So to get a clean system, I removed svn:

$ brew remove subversion
Uninstalling /usr/local/Cellar/subversion/1.8.0...

And wanted to install it again with the java bindings and as universal binaries (with 32bits and 64bits support), but got an error message:

$ brew install --universal --java subversion
Error: subversion dependency serf not installed with:
--universal

So I had to remove serf so that it can be installed also as a universal binary:

$ brew remove serf
Uninstalling /usr/local/Cellar/serf/1.2.1...

And after serf, came sqlite:

$ brew install --universal --java subversion
Error: subversion dependency sqlite not installed with:
--universal
$ brew remove sqlite
Uninstalling /usr/local/Cellar/sqlite/3.8.0...

Now I could install subversion but it didn’t manage to create all the links because some links were left over from an older installation:

$ brew install --universal --java subversion
==> Installing subversion dependency: sqlite
...
==> Installing subversion dependency: serf
...
==> Installing subversion
...
Warning: Could not link subversion. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link subversion'

Possible conflicting files are:
...

It’s easy to fix by using the –overwrite option with brew link:

$ brew link --overwrite subversion
Linking /usr/local/Cellar/subversion/1.8.0... 108 symlinks created

Now svn 1.8 is installed properly (including the Java language binding for the Subversion API i.e. JavaHL). But when I tried in Eclipse to synchronize with an svn repository, I got the following error message:

Incompatible JavaHL library loaded. Subversion 1.7.x required.

This basically means that this version of JavaHL is not supported by the installed version of subclipse. In fact, the Subversion Wiki also gives you this info:

Subclipse Version SVN/JavaHL Version
1.10.x 1.8.x
1.8.x 1.7.x
1.6.x 1.6.x
1.4.x 1.5.x
1.2.x 1.4.x
1.0.x 1.4.x

You can check which version of Subclipse is installed in the “About Eclipse” menu item (click there on “Installation details” and search for Subclipse). If you see e.g. that Subclipse 1.8.1 is installed, the table tells you it will only work with svn 1.7. So we need a newer version of Subclipse. My first idea was to run an update in Eclipse. But it updated some other software but nothing related to subclipse. Then I notice that the update site I had used to install subclipse was:¬†http://subclipse.tigris.org/update_1.8.x

This means that it will provide minor updates like 1.8.2, 1.8.3 and so on but no major update like the version 1.10.x that we need for svn 1.8. So I added a new update site for Subclipse 1.10.x: http://subclipse.tigris.org/update_1.10.x/

Then installed Sublipse 1.10.2 from this update site and after my sync with the svn repository was successful !

Eclipse and subversion: Failed to Load JavaHL Library

I haven’t used eclipse for some time (I recently spent more time upgrading, securing servers and writing shell scripts than actually programming). Now I wanted to check what the status of one of my latest projects was. But when I started Eclipse and synchronized with the subversion repository, I got the following error message:

Failed to load JavaHL Library.
These are the errors that were encountered:
no libsvnjavahl-1 in java.library.path
no svnjavahl-1 in java.library.path
no svnjavahl in java.library.path
java.library.path = .:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java

I then searched for this library in the library path (was not sure it was really missing there), and found something:

$ ls -l /Library/Java/Extensions/libsvnjavahl-1.*
lrwxr-xr-x  1 root  admin  35 Mar 22  2013 /Library/Java/Extensions/libsvnjavahl-1.dylib -> /usr/local/lib/libsvnjavahl-1.dylib

I somehow remembered there were two files last time I had issues with the subversion integration. So I followed the linked and checked what was in /usr/local/lib:

$ ls -l /usr/local/lib/libsvnjavahl-1.*
lrwxr-xr-x  1 henribenoit  admin  53 Jul 24 23:35 /usr/local/lib/libsvnjavahl-1.0.dylib -> ../Cellar/subversion/1.7.8/lib/libsvnjavahl-1.0.dylib
lrwxr-xr-x  1 henribenoit  admin  47 Jul 24 23:35 /usr/local/lib/libsvnjavahl-1.a -> ../Cellar/subversion/1.7.8/lib/libsvnjavahl-1.a
lrwxr-xr-x  1 henribenoit  admin  51 Jul 24 23:35 /usr/local/lib/libsvnjavahl-1.dylib -> ../Cellar/subversion/1.7.8/lib/libsvnjavahl-1.dylib
lrwxr-xr-x  1 henribenoit  admin  52 Jul 24 23:35 /usr/local/lib/libsvnjavahl-1.jnilib -> ../Cellar/subversion/1.7.8/lib/libsvnjavahl-1.jnilib

So I have a link to the .dylib file in /Library/Java/Extensions/ but I miss a link to the .jnilib. Easy to fix:

$ ln -s /usr/local/lib/libsvnjavahl-1.jnilib /Library/Java/Extensions/libsvnjavahl-1.jnilib

After that I could syncronize with the svn repository in Eclipse !

Another solution I tried is to move away from the jni based svn client adapter and use the pure Java SVNKit adapter. To change this setting, go to the Eclipse preferences and write svn in the filter:

SVN interface client

I’ve resized the window to only show the relevant setting, this dialog actually has many more settings. In the displayed select box you can choose between JavaHL (JNI) and SVNKit (Pure Java). If you use SVNKit, you don’t need to have access to the native library shown above.

When it comes to choosing between JavaHL and SVNKit: When a new version of subversion is available, JavaHL is usually available earlier. So you can upgrade earlier. But it is often more difficult to install and integrate than SVNKit.

Problems with SVN in Eclipse on Mac OS X Mountain Lion (10.8)

I’m working on a new PHP project. Until now I’ve mainly been working on a Windows machine but today I wanted to move to my MacBook. So I just created a working copy and created a PHP project in Eclipse referencing the working copy. Unfortunately I got the following error message:

Failed to load JavaHL Library.
These are the errors that were encountered:
no libsvnjavahl-1 in java.library.path
/usr/local/Cellar/subversion/1.7.8/lib/libsvnjavahl-1.0.dylib:  Library not loaded: /usr/local/lib/libsqlite3.0.8.6.dylib   Referenced from: /usr/local/Cellar/subversion/1.7.8/lib/libsvnjavahl-1.0.dylib   Reason: image not found
no svnjavahl in java.library.path
java.library.path = .:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java

I already had some issues with SVN on Mountain Lion some time ago. But I thought I was done with it. After carefully reading the error message, I remember I had just upgraded my Home Brew package and saw the following while upgrading sqllite:

==> Upgrading sqlite
==> Downloading http://sqlite.org/sqlite-autoconf-3071502.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/sqlite/3.7.15.2 --enable-dynamic-extensions
==> make install
==> Caveats
This formula is keg-only: so it was not symlinked into /usr/local.

Mac OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.

OS X already provides (an older) sqlite3.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/sqlite/lib
    CPPFLAGS: -I/usr/local/opt/sqlite/include

OK, so now what ? First check whether the library missed by Eclipse is really missing:

$ ls -l /usr/local/lib/libsqlite3.0.8.6.dylib
ls: /usr/local/lib/libsqlite3.0.8.6.dylib: No such file or directory

Ok, then try to find it:

$ find /usr -name "libsqlite3.0.8.6.dylib"
/usr/local/Cellar/sqlite/3.7.10/lib/libsqlite3.0.8.6.dylib
/usr/local/Cellar/sqlite/3.7.13/lib/libsqlite3.0.8.6.dylib
/usr/local/Cellar/sqlite/3.7.14.1/lib/libsqlite3.0.8.6.dylib
/usr/local/Cellar/sqlite/3.7.15/lib/libsqlite3.0.8.6.dylib
/usr/local/Cellar/sqlite/3.7.15.2/lib/libsqlite3.0.8.6.dylib
find: /usr/sbin/authserver: Permission denied

Ok so I have the choice. Now let’s just create a soft link to one of them:

$ ln -s /usr/local/Cellar/sqlite/3.7.15.2/lib/libsqlite3.0.8.6.dylib /usr/local/lib/libsqlite3.0.8.6.dylib

Now, deleting the project and recreating again isn’t enough since it will not try again to get the whole subversion thing working. You need to restart eclipse and recreate the project.
This time the subversion binding did work and after converting the working copy (it looks like I created it with svn 1.6 instead of 1.7), everything was working fine !

Eclipse: No entries available when choosing PHP file for debugging

I have Eclipse Juno installed. I created a PHP project for a new application I’m working on (you’ll hear more about this project in the next weeks), imported the code. Then I wanted to debug it. But run into a few problems…

First I couldn’t create a “PHP Web Application” debug configuration because of the following error:

 No tab group defined for launch configuration type org.eclipse.php.debug.core.launching.webPageLaunch

After spending some time on Google I found out it is because Eclipse Juno comes with an older version of PDT and I needed to install 3.1.1 or newer. Some how it also took me a while to find out that the right update site was http://download.eclipse.org/tools/pdt/updates/3.2/release/. Well everybody is allowed to have a slow brain once in a while…

While installing got another error with some missing dependencies… The PDT Core Unit Tests was missing bundle org.eclipse.dltk.core.tests 0.0.0. The package name ending with 0.0.0 doesn’t seem right but it was solved by just installing PDT and not the Unit Tests package. I wasn’t really planning to use this package but it’s always nice to know I couldn’t even if I wanted to :-).

Then I checked the debug configuration again. Now I was able to create a PHP Web Application debug configuration but when I clicked on Browse to select the file to debug, I just got a disabled UI saying that no files were available. Searching in Google confirmed that I’m not the only one with the problem but I didn’t find a documented solution except some hints that it might mean that I didn’t have a PHP project. But I actually did have one (had the nice PHP icon next to my project name in the project explorer). Since googling wasn’t looking very promising, I started looking all context menu entries when right clicking on the project. And I found a menu entry:

Configure > Add PHP Support...

Well it actually didn’t make much sense to me. Why would I need to add PHP support to a PHP project. If anything should already have PHP support, it should be a PHP project. But I didn’t have any other lead so I just did it. It updated the project file. And there it was, I was then able to select a PHP file to debug !!

Summary:

  • Update the PDT installation in Eclipse to the newest one
  • Only install the PDT package and not the PDT Core Unit Tests package
  • Add PHP support to your PHP project

Eclipse: Setting the proxy configuration

I wanted to install the EGit plugin in eclipse and couldn’t connect to the marketplace. So I checked the proxy settings in Window / Preferences / General / Network Connections.
Proxy settings in Eclipse
It was set by default to Native. My understanding is that Native means to use the settings of the OS. I’m running Windows 7 64 bits. Somehow no connection was possible. So I changed it to Manual and manually entered the proxy hostname and port in all three entries. This didn’t work either.

Then I noticed that the third one wasn’t FTP but SOCKS (I’ve somehow looked at the dialog X times and each time read FTP instead of SOCKS). Since there are checkboxes in front of the entries I tried unchecking the one in front of SOCKS but it didn’t seem to be an editable check box. So I selected SOCKS and pressed Clear. And there it was, I could now connect to the marketplace! I somehow really hate this dialog. From a usability point of view it’s a real mess. But of course if I first had thought and then entered something in the SOCKS entry, I would have saved quite some time… Stupid me…