Details
-
Bug
-
Resolution: Unresolved
-
None
-
None
-
None
-
Operating System: Linux
Platform: PC
-
normal
-
P1
-
283
Description
Usually APIs don't depend on implementations, but that's not the case of slf4j.
At first it may look like slf4j-api has no dependency on implementation, at least
it's not specified in pom.xml. But slf4j-api source contains a dummy implementation which is removed (using maven-antrun-plugin) before packaging slf4j-api into a jar. This means that slf4j-api has runtime dependency on one of implementations and loading slf4j-api with missing implementation will fail. Build-time dependency on implementation is avoided by embedding the dummy implementation, which is removed after compilation.
This cyclic dependency between API and implementations is causing problems loading slf4j bundles by OSGi framework (tested with Eclipse Equinox). OSGi framework reports error "A cycle was detected when generating the classpath slf4j.api, slf4j.nop, slf4j.api."
This problem can be solved by adding "resolution:=optional" parameter to Import-Package in slf4j-api manifest. The attached patch does that. This patch was applied a few days ago in Fedora GNU/Linux distribution (which ships version 1.7.2 of slf4j) and it was tested with Eclipse. No problems were caused by the patch.
Version of slf4j: 1.7.2
(bugzilla doesn't list version 1.7.x)