[slf4j-dev] [Bug 283] New: Cyclic OSGi dependency between API and implementations

bugzilla-daemon at qos.ch bugzilla-daemon at qos.ch
Wed Nov 21 20:32:27 CET 2012


http://bugzilla.slf4j.org/show_bug.cgi?id=283

           Summary: Cyclic OSGi dependency between API and implementations
           Product: SLF4J
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Core API
        AssignedTo: slf4j-dev at qos.ch
        ReportedBy: mizdebsk at redhat.com


Created attachment 89
  --> http://bugzilla.slf4j.org/attachment.cgi?id=89
Patch removing cyclic dependency

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)

-- 
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the slf4j-dev mailing list