Skip to content

Roboconf over Karaf 4 guide

Vincent Zurczak edited this page Apr 10, 2015 · 5 revisions

Roboconf on Apache Karaf 4.x Guide

Roboconf relies on the Apache Karaf OSGi runtime. For now, the v3.0.3 version is used, but upcoming features will need a version upgrade, such as the use of a WebSocket compatible Web container. This document details how to build Roboconf using the Apache Karaf project, v4.x.

WARNING:
At the time this document is written, the 4.0.0 version of the Apache
Karaf project is not released yet (scheduled for 2015/04/11). The build
steps detailed hereafter are based on SNAPSHOTS versions build from
trunk, which may be unstable.

Building Karaf 4.x from trunk

Source checkout

git clone git://git.apache.org/karaf.git
# or from mirror on GitHub: [email protected]:apache/karaf.git

Missing SNAPSHOT dependencies

The Karaf trunk build needs a few additional steps. It relies on several SNAPSHOT maven dependencies, but these dependencies cannot be found in the Maven central repository, or any repository used by the Karaf at build-time. They must be retrieved by hand and installed locally.

The following list details, for each missing dependency, the location where it can be downloaded.

  • org.apache.felix/org.apache.felix.connect/0.1.0-SNAPSHOT:
    This one cannot be found anywhere, so the workaround is to checkout the sources of the Apache Felix project and install the project in the local Maven repository. The javadoc plugin may prevent the build, so it is disabled.
git clone git://git.apache.org/felix.git
# or from mirror on GitHub: [email protected]:apache/felix.git
cd felix/connect
mvn install -Dmaven.javadoc.skip=true

All the downloaded bundles must be installed in the local Maven repository, using the following command:

mvn install:install-file \
  -Dfile=<path to file> \
  -DgroupId=<group id> \
  -DartifactId=<artifact id> \
  -Dversion=<version> \
  -Dqualifier=<qualifier> \
  -Dpackaging=<packaging>

Or you can add this profile in your ~/.m2/settings.xml file.

<profile>
<id>karaf</id>
<repositories>
 	<repository>
 		<id>Apache Snpashots</id>
 		<url>https://repository.apache.org/content/groups/snapshots</url>
 		<snapshots>
 			<enabled>true</enabled>
 			<updatePolicy>daily</updatePolicy>
 		</snapshots>
 	</repository>
 	
 	<repository>
 		<id>labs.consol</id>
 		<url>http://labs.consol.de/maven/snapshots-repository</url>
 		<snapshots>
 			<enabled>true</enabled>
 			<updatePolicy>daily</updatePolicy>
 		</snapshots>
 	</repository>
 	
 	<repository>
 		<id>OPS4J</id>
 		<url>https://oss.sonatype.org/content/repositories/ops4j-snapshots</url>
 		<snapshots>
 			<enabled>true</enabled>
 			<updatePolicy>daily</updatePolicy>
 		</snapshots>
 	</repository>
 	
	<repository>
		<id>com.springsource.repository.bundles.release</id>
		<name>SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases</name>
		<url>http://repository.springsource.com/maven/bundles/release</url>
	</repository>
		
	<repository>
		<id>com.springsource.repository.bundles.external</id>
		<name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>
		<url>http://repository.springsource.com/maven/bundles/external</url>
	</repository>
</repositories>
</profile>

Then, add it to your default profiles or use the -P karaf option when you compile Karaf.

At last… Build indeed!

mvn -Pfastinstall

... or...

mvn -P fastinstall, karaf

The ZIP and TAR distributions are located under the assemblies directory.

Building Roboconf on Karaf 4.x

Karaf 4.x has introduced some subtle changes that impact the normal Roboconf build. Thus, some modifications of the Roboconf build instructions (pom.xml) are required. The following fork of the Roboconf platform include those modifications.

Inside the Roboconf platform source directory, type:

git remote add fork.bourretp [email protected]:bourretp/roboconf-platform.git
git fetch fork.bourretp
git checkout feature/karaf-4-snapshot

and finally…

mvn clean install

Running Roboconf on Karaf 4.x

Preparing the distribution.

Before running Roboconf, you need to fix a bug in the generated distributions. Well, this is not really a bug in the distribution, but rather a bug in the way Karaf searches artifacts in its included Maven repository (the one in the system directory). The bug concerns the Apache Felix framework artifact, which is the very base runtime layer of Karaf itself, so the distribution cannot boot at all.

To resolve this issue, you must rename the Apache Felix framework artifact, so Karaf can find it. Inside the generated distribution, find the system/org/apache/felix/org.apache.felix.framework/4.9.0-SNAPSHOT/org.apache.felix.framework-4.9.0-<whatever>.jar file, and replace the <whatever> part by SNAPSHOT: org.apache.felix.framework-4.9.0-SNAPSHOT.jar

Note that this fix must be performed on both dm and agent distributions.

TODO: automate this task in the distributions' pom.

Run Roboconf

Now you can safely run Roboconf, flavored with Karaf 4.x:

bin/karaf

For some (yet) unknown reason, the Roboconf (console) branding does not seem to work properly, but this is definitely non-blocking.