I have put together a simple example of the problem I'm been encountering 
attempting to create a custom karaf distribution.

If you attempt to include a bundle such as 
org.apache.felix:org.apache.felix.http.servlet-api in a feature, you get this 
build error:

missing requirement [org.ops4j.pax.url.wrap/2.5.2] osgi.wiring.package; 
filter:="(&(osgi.wiring.package=org.slf4j)(version>=1.6.0)(!(version>=2.0.0)))"

org.apache.felix.http.servlet-api has a "compile" dependency on 
org.apache.tomcat/tomcat-servlet-api/8.0.9 and this is interpreted by the karaf 
maven plugin as a dependency. Whether it should do that or not I don't know. It 
doesn't seem like it should, but that's not the issue. Having made that 
interpretation, it then adds a dependency on 
wrap:mvn:org.apache.tomcat/tomcat-servlet-api/8.0.9, since it isn't proper OSGi 
bundle. The build then fails with the above error.

I don't understand how to resolve this issue. 

If I remove this and build karaf, in the result, I can see that wrap starts, 
and satisfies the requirement from the pax-logging bundle:
  Imported Packages
  org.slf4j,version=1.7.13 from org.ops4j.pax.logging.pax-logging-api (6)
  org.slf4j,version=1.7.7 from org.ops4j.pax.logging.pax-logging-api (6)
  org.slf4j,version=1.7.1 from org.ops4j.pax.logging.pax-logging-api (6)
  org.slf4j,version=1.6.6 from org.ops4j.pax.logging.pax-logging-api (6)
  org.slf4j,version=1.5.11 from org.ops4j.pax.logging.pax-logging-api (6)
  org.slf4j,version=1.4.3 from org.ops4j.pax.logging.pax-logging-api (6)

So I don't get why it can't be resolved during the build. Is there some 
dependency I need to add to my feature in the features.xml file? It doesn't 
feel like I should, as my feature doesn't really depend on "wrap", and I 
shouldn't be concerned with what it itself then depends on?

It feels like the dependency on tomcat-servlet-api is being added in error, but 
I could live with that if I could get the result to compile.

See code at https://github.com/tomq42/karaf-tests-1

Thanks.

Reply via email to