I am very new to OSGi and Karaf and I am still getting my head around the concepts and architecture.
My question is related to the .kar files which are created with the karaf-maven-plugin.
Does a .kar file meant to only install features into a Karaf runtime? What if we create a bundle and rename it to .kar instead of .jar. Is this a valid use case for .kar files?
Thanks
No, a
karfile is much more than that as it is a mechanism to provide not only thefeatures.xmlbut also any related OSGi bundles, configuration files, aso. inside a single artifact.That's also why it contains a mandatory
repository/directory (basically containing all OSGi bundles necessary for any of the features described by thefeatures.xmlin a Maven repository-style structure) and an optionalresources/directory (containing all the additional resources referenced by a feature).For a fully fledged example, you can have a look at the Apache Karaf framework archive:
That one contains all the basic resources that make up the base for a custom Karaf installation and provide the basic set of features: