0

I am trying to create a Karaf assembly using Maven (and NetBeans). I create my bundles using declarative services, but I am having problems creating feature files. Part of my problem is the error messages that OSGi generates. But I have a more general questions.

I have discovered that I can call karaf-maven-plugin in the project that creates my bundles and it generates what appears to be a comprehensively populated feature file based on the dependencies of the bundle. (Method 1)

However, I have read somewhere that creating a feature file with karaf-maven-plugin should normally only be done in a project with feature packaging. If I do this, it seems to me that I have to create the feature file by hand, which is not a lot of fun. (Method 2)

No matter which method I use, I have been unable to successfully generate a Karaf assembly that contains anything other than simple bundles without any dependencies. I am currently stuck trying to install a single bundle that needs to wrap some non-OSGi dependencies. Method 1 above generates the wrap stuff (<feature> and wrap: protocol). All I get is the following error:

Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.1.0:assembly (default-assembly) on project EnoceanBridgeAdmin: Unable to build assembly: [wrap/0.0.0]

EnoceanBridgeAdmin is the karaf-assembly packaging that I'm trying to build. It has a dependency on the bundle that contains the generated feature file (where wrap is referenced):

<dependency>
    <groupId>net.winnall.enocean.service.impl</groupId>
    <artifactId>EnoceanBridgeSASS.Impl</artifactId>
    <version>0.99.99</version>
    <type>xml</type>
    <classifier>features</classifier>
</dependency>

So my questions:

  1. Is method 1 above a correct usage?
  2. Can I automatically generate a feature file to use method 2?
  3. Will the error message disappear after I've got method 1 or 2 sorted?

Steve

ImranRazaKhan
  • 1,955
  • 5
  • 33
  • 74
Stephen Winnall
  • 301
  • 3
  • 14

1 Answers1

0

I have resolved this myself.

  1. Method 1 does not work because karaf-maven-plugin generates <feature> definitions for wrap. These cause the error mentioned above. Apparently – at least with Karaf 4.1.0 – the wrap: protocol is used in a feature file without a prior <feature> definition.
  2. Method 2 (writing the feature file yourself) is thus the only viable option because of the behaviour of karaf-maven-plugin.
  3. Yes, the error message disappeared :-)
Stephen Winnall
  • 301
  • 3
  • 14