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:
- Why is
org.slf4j.impl
not considered exported and hence cannot be resolved?
Minor questions:
Where does the
Bundle-SymbolicName
in the error message come from?Where does the qualifier
v20200428-2012
oflogback-classic
's JAR in the Target Platform definition come from? It'sMANIFEST.MF
doesn't contain this, but justBundle-Version: 1.2.3
.Why does
slf4j-api
importorg.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?