[slf4j-user] slf4j-api bundle requires an org.slf4j.impl package present to build in PDE
Patrik Blommaskog
pblommaskog at hotmail.com
Wed Oct 26 14:56:49 CEST 2011
When building an Eclipse PDE component using Maven, I specify a dependency to slf4j-api in the Maven pom.xml file. In the MANIFEST.MF, I have the line:
Import-Package: org.slf4j
This gives an error when I build:
generate: [eclipse.buildScript] Some inter-plug-in dependencies have not been satisfied. [eclipse.buildScript] Bundle com.mycompany.model: [eclipse.buildScript] Unsatisfied import package org.slf4j_0.0.0. [eclipse.buildScript] Bundle slf4j.api: [eclipse.buildScript] Unsatisfied import package org.slf4j.impl_1.6.0.
Somewhy, the build process seems to pick up the org.slf4j.impl package import as specified in the manifest file of the slf4j-api bundle, and sees it as a mandatory requirement. As I see it, it shouldn't, since my component can both compile and run without any .impl package.
A way to work around this is to include the slf4j-nop bundle in the pom file. That one will then satisfy the org.slf4j.impl import. But this creates some other issues with non-intuitive transitive dependencies downstream.
What *does* work cleanly - I tested it - is to specify the package import in slf4j-api bundle as optional. That is, in the MANIFEST.MF file, the line should read:
Import-Package: org.slf4j.impl;version=1.6.0;resolution:=optional
That way, any build/import process that tries to resolve dependencies can see that it is ok to leave it unresolved.
I did find http://bugzilla.slf4j.org/show_bug.cgi?id=75 which touches the issue (resolution:=optional is mentioned) but seems to have a larger scope and is about an older version of slf4j. I am using 1.6.2.
Now, should I use slf4j in another way to resolve the dependency problem, or does it make sense to submit a bug report/change request with my fix?
-Patrik
More information about the slf4j-user
mailing list