How to use Z2 with Subversion

Principles

Instead of using Git as component repository storage, you can instead use the Subversion Source Control Management System. Using a Subversion (or SVN for short) backed component repository is very similar to any other component repository. Essentially you:

  1. Declare repositories as com.zfabrik.svncr components, rather than for example com.zfabrik.gitcr components. The reference at http://www.z2-environment.eu/v22doc#subversionComponentRepositories describes the details.
  2. Have the typical component repository structure consisting of modules and components at where your repository URL point to. In contrast to Git, with Subversion you may have as many component repositories in one Subversion repository as you like.

Please also check out First steps with Z2 on SVN.

All Git repositories hosted on this site are also available as Subversion repositories. See Repositories for more details.

Configuring Z2 for Subversion access

There is one pre-requisite however. You need to configure z2 for Subversion repository access. Starting after version 2.3, Z2 no longer provides the SVNKit libraries, in order to have a simpler license regime (only Apache 2 and compatible).

You may use z2 with two different access methods:

  • JavaHL: Using the JavaHL API requires you to install a native library and a wrapper API on the operating system you run Z2 on. The good news is that OS packages are available - at least for linux-style systems. This approach means there is no code with problematic license required in Z2.
  • SVNKit: If the SVNKit license (check out http://www.svnkit.com/licensing.html) is acceptable for your use-case you may simply modify your z2 core in a way to make use of SVNkit as Subversion access API. SVNKit is a pure-Java implementation, requires no further OS modification, and is somewhat faster than JavaHL.

Configuring for JavaHL

In the example of recent Ubuntu releases, installing JavaHL means to run


sudo apt-get install libsvn-java

After that, you will have

  1. a native library libsvnjavahl-1.so in /usr/lib/x86_64-linux-gnu/jni/lib
  2. a wrapper API jar /usr/share/java/svn-javahl.jar

If these paths differ, your configuration change needs to be adapted accordingly. In order to make sure Z2 can load these libraries, we need to set the java.library.path configuration for the VMs as well as we need to adapt the z2 classpath. It is simplest to apply both configurations in the file run/bin/launch.properties of your z2 <home> installation.

In that file you will find a home.vmopts property that may look like this:

home.vmopts=\
    -Xms32M -Xmx64M -cp z.jar \
    -Dcom.sun.management.config.file=management.properties \
    -Djava.util.logging.config.file=logging.properties \
    -Dcom.zfabrik.home.concurrency=5 \
    -Dcom.zfabrik.home.layout=environment/home \
    -Dcom.zfabrik.dev.local.workspace=../../../../../.. \
    -Dcom.zfabrik.mode=development \
    -Dcom.zfabrik.hubcr.mode=relaxed \
    -Dcom.zfabrik.system.id=z2_core

Using the paths from above, change this to (changes in bold):


home.vmopts=\
    -Xms32M -Xmx64M -cp z.jar:/usr/share/java/svn-javahl.jar \
    -Djava.library.path=/usr/lib/x86_64-linux-gnu/jni/ \
    -Dcom.sun.management.config.file=management.properties \
    -Djava.util.logging.config.file=logging.properties \
    -Dcom.zfabrik.home.concurrency=5 \
    -Dcom.zfabrik.home.layout=environment/home \
    -Dcom.zfabrik.dev.local.workspace=../../../../../.. \
    -Dcom.zfabrik.mode=development \
    -Dcom.zfabrik.hubcr.mode=relaxed \
    -Dcom.zfabrik.system.id=z2_core

Done. At first attempt, Z2 will report

Found JavaHL support. Will use JavaHL repository access

Note: Alternatively to specifying the path for native library lookup in launch.properties, on linux you may specify an environment variable LD_LIBRARY_PATH.

Configuring for SVNKit

Assuming license restrictions are acceptable for you:

  1. Go to www.svnkit.com and download a recent standalone distribution,
  2. Expand the lib folder of the svnkit distribution into the already present folder run/local/com.zfabrik.boot.svnaccess.svnkit/java/bin.api/lib of your Z2 <home> installation. This folder is there for exactly the purpose of holding the SVNKit libraries, if needed.

Please make sure the libraries are really in that folder rather than some nested folder that may have been created during extraction.

Done. At first attempt, Z2 will report

Found SVNKit support. Will use SVNKit repository access.

Note: If present, SVNKit will be used with preference over JavaHL.