Few weeks ago I started playing with the Apache Karaf application server. I already had some experience with OSGi containers, namely Eclipse Virgo as part of my regular job and I wanted to see what else is out there. To quickly outline the major differences between the servers, Virgo is using Equinox OSGi implementation provided by Eclipse (and powering the IDE of the same name) while Karaf is a subproject of Apache Felix, another major OSGi implementation. Karaf can use both Felix and Equinox but by default uses the former. Both application servers support web application bundles (the OSGi equivalent of WARs) and other enterprise features.
Getting acquainted with Karaf, I came to appreciate its tooling the most – there is a Maven plugin that makes the creation and maintenance of OSGi bundles a walk in the park. Still the tooling documentation is a bit lacking and having lost around three weeks with the project, cross-checking tutorials, official documentation, mailing threads and Karaf’s codebase I decided that it would be beneficial to have my sample project as a blueprint (pun intended) for other people interested in developing Karaf-based applications.
The sample project demonstrates the following OSGi / Karaf features:
- Maven bundle packaging.
- Maven kar packaging.
- Maven karaf-assembly packaging.
- Vanilla OSGi bundles.
- Blueprint-wired bundles.
- Web bundles.
- Preparing a Karaf archive a.k.a. a KAR.
- Building a customized Karaf distribution.