0

I'm using org.slf4j:slf4j-api:1.7.30 and ch.qos.logback:logback-classic:1.2.3 in one of my bundles (Maven <packaging>eclipse-plugin) via the project's Target Platform definition (i.e. another Maven project with <packaging>eclipse-target-definition).

The slf4j-api JAR's MANIFEST.MF contains:

...
Import-Package: org.slf4j.impl;version=1.6.0

The logback-classic JAR also contains the package org.slf4j.impl and its MANIFEST.MF contains:

...
Export-Package: ...
 ....................., org.slf4j.impl;versi
 on="1.7.25";uses:="org.slf4j,org.slf4j.spi"
...

If I add:

Import-Package: ...
 ...
 org.slf4j,
 ch.qos.logback.classic,
 org.slf4j.impl

to my bundle's MANIFEST.MF` only the first two are resolved. For the latter Eclipse shows the error:

Bundle 'ch.qos.logback.slf4j' exporting package 'org.slf4j.impl' is unresolved

and the ch.qos.logback.classic_1.2.3.v20200428-2012.jar in my bundle's Plugin-Dependencies folder shows only ch.qos.logback.classic package and sub-packages thereof.

Major question:

  1. Why is org.slf4j.impl not considered exported and hence cannot be resolved?

Minor questions:

  1. Where does the Bundle-SymbolicName in the error message come from?

  2. Where does the qualifier v20200428-2012 of logback-classic's JAR in the Target Platform definition come from? It's MANIFEST.MF doesn't contain this, but just Bundle-Version: 1.2.3.

  3. Why does slf4j-api import org.slf4j.impl? Shouldn't rely an implementation on an API and not vice versa?

UPDATE

I found answers to 2. and 3. (not the first that this happens while writing an SO question :): It's from Eclipse itself: https://ftp.fau.de/eclipse/releases/2021-03/202103171000/plugins/

And this also leads to an answer for 1.: I'm actually not using the orignal slf4j and logback JARs but those from Eclipse and ch.qos.logback.slf4j's MANIFEST.MF contains:

...
Export-Package: org.slf4j.impl;x-internal:=true;version="1.7.30";uses:
 ="org.slf4j,org.slf4j.spi"
...

So 5. How to get the package org.slf4j.impl exported/imported nevertheless?

Gerold Broser
  • 14,080
  • 5
  • 48
  • 107
  • 1
    Please improve your question instead of adding an _UPDATE_ section and provide a minimal reproducible example. – howlger May 21 '21 at 10:46
  • Isn't one of the goals of SLF4J to not talk directly to the implementation? – nitind May 21 '21 at 13:35
  • @nitind That's what I thought, too. It has been [deactivated in v1.8.0](https://github.com/qos-ch/slf4j/commit/7a1d11ef60fe38f158c967f5630a33863ae2269c#diff-9801981279a3fa96ec808fa91c0b915bccba33451ef0eabfc53bae8e0a39de24) but it's still in v1.7.x. – Gerold Broser May 21 '21 at 13:57

0 Answers0