You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by to...@quarendon.net on 2017/06/14 11:13:06 UTC

Karaf maven plugin/wrap/slf4j problem

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.

Re: Karaf maven plugin/wrap/slf4j problem

Posted by to...@quarendon.net.
> I propose to share the code and chat directly (on hangout/skype/private e-mail).
Any help you can give me would be greatly appreciated.
I have many issues that I'm trying to resolve, as you can tell.

Re: Karaf maven plugin/wrap/slf4j problem

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Tom,

I will take a look on your code.

You custom distribution needs the log feature providing slf4j packages, else 
wrap will need the slf4j package.

Tom, it's really hard to follow how you define your feature/custom distribution.

I propose to share the code and chat directly (on hangout/skype/private e-mail).

Regards
JB

On 06/14/2017 01:13 PM, tom@quarendon.net wrote:
> 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.
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com