Building a custom Apache Karaf distribution is a topic that hasn't really been explained in full anywhere, but has been asked by quiet a few people. Since I'm playing around with a small personal side project that reuses Apache Karaf as the platform for a Rogue like text game I thought that I'd make a few posts about the process. I'm not going to be able to explain all the various details involved here, and this certainly isn't a best practices guide, however you may use some of the posts following this project to help start your own efforts.
To start, obtain the Apache Karaf source tree from svn. Please see the Apache Karaf source documentation page for details on how to go about this. For building your own distribution I would recommend checking out a tagged version of Apache Karaf, as latest from trunk can not be guaranteed to be stable at any one point in time. Once you have obtained a copy of the source tree we can start the customization process. Please note we won't be modifying the Karaf source directly, we just obtain a copy for future reference. The actual distribution modifications will take place in a new project pom, more on that later.
Let's tackle the low lying fruit first by following the instructions found in my rebranding post. Since this is a Rogue like text game I decided to name it "KarHack". I don't intend to build a full Java version of NetHack/Rogue here, I just want to mock up a quick & dirty demo. To generate the cool ASCII banner in the figure below I used the following site http://www.network-science.de/ascii/. Starting up Karaf with the custom branding presents the user with the following welcome screen: