Uploaded image for project: 'SLF4J'
  1. SLF4J
  2. SLF4J-274

Cyclic OSGi dependency between API and implementations

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • None
    • Core API
    • None
    • Operating System: Linux
      Platform: PC

    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)

      Attachments

        Activity

          People

            slf4j-dev SLF4J developers list
            mizdebsk@redhat.com Mikolaj Izdebski
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: