Search code examples
osgiapache-karafosgi-bundlekaraf

In Apache Karaf, how can a KAR file instruct Karaf to install features?


I have a KAR file which I produced for Apache Karaf.

Now to get my KAR to run in Karaf 2.4.1 I must manually type into Karaf console the following to allow declarative services to work.

features:install scr

Is there a way for my KAR file to instruct Karaf to install this scr automatically?

The point is that I would like to be able to deploy a KAR by just dropping it into Karaf deploy folder without having to do any manual command.


Solution

  • A KAR contains a features XML file, correct? Add the scr feature into your features XML file as a dependent feature. See the section on Dependent Features in Karaf Provisioning.