SyntaxHighlighter JS


Create a custom Apache Karaf server

What you will do:
  • Create a custom Apache Karaf distribution using karaf-maven-plugin
  • Create a custom logo using maven-bundle-plugin
What you will learn:
  • Configure karaf-maven-plugin
  • Build a OSGi bundle using maven-bundle-plugin
  • Use maven-dependency-plugin for post-processing
This tutorial creates a custom Karaf 3 server called "Dekantar" using Maven. The procedure for Karaf 2 and 4 are similar.
Karaf 2: Coming soon
Karaf 3:
Karaf 4: Coming soon

Step 1: Import the Karaf 3 dependencies
Add the following entry in the dependencyManagement section of the pom.xml
<!-- Import Karaf POM to use the correct 
     version of the Karaf dependencies -->

Doing this will automatically configure the custom Karaf Maven build to use the correct version of dependencies libraries.

See for full example.

Step 2: Configure the karaf-maven-plugin
Add the following entry to the pom.xml to configure karaf-maven-plugin to build Karaf
<!-- Scope is compile so all features (there is only one) are installed
     into and
     the feature repo itself is not added in
     etc/org.apache.karaf.features.cfg file
<!-- Scope is runtime so the feature repo is listed
     in etc/org.apache.karaf.features.cfg file,
     and features will installed into the system directory.
     This imports the standard Karaf features described at
     These features are installed in the karaf-maven-plugin configuration
    <!-- bootFeatures starts up these features when Karaf first boots up.
         The feature names are obtained from the features.xml in the
         dependencies section
    <!-- installedFeatures only installs the libraries but the user will
         have to start it up manually via Karaf command line feature:install

Step 3: Create customized logo
You can customize the logo displayed when users first log in via command line

A.) Create the file src/main/resources/org/apache/karaf/branding/
This file configures the welcome logo and command prompt.

B.) Configure maven-bundle-plugin to create an OSGi bundle with the file.  Add the following entry in the pom.xml

The maven-bundle-plugin creates a JAR file with a META-INF/MANIFEST.MF and .

See for full example.

C.) Configure maven-dependency-plugin to copy the branding JAR created in step B into the Karaf lib directory.  Add the following entry to the pom.xml
        <!-- target/assembly is the directory karaf-maven-plugin
  assembles all the files of the Karaf server -->

See for full example.

Step 4: Build it
Run mvn clean install
The output file is target/custom-karaf-server.tar.gz and target/

No comments:

Post a Comment