Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-4789

Make bson.record.codec module optional for OSGi

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.8.0
    • Affects Version/s: None
    • Component/s: Build
    • Labels:
      None
    • Minor Change
    • Needed

      Currently the Java Driver can't be used in OSGi containers using a Java version lower than 17, which according to the compatibility matrix should not happen, as it should be compatible from Java 8+.

      The problem is that there is a dependency of bson.codecs.record, which requires Java17+ according to its MANIFEST.MF:

      Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=17))"
      

      This change will make the Import-Package attribute for bson.codecs.record optional, meaning when trying to use it in a OSGi container it won't fail because the dependency can't be satisfied in lower versions than 17.

      After building with the proposed change applied, that line in the MANIFEST.MF file will look like this:

      org.bson.codecs.record;resolution:=optional;version="[4.7,5)"
      

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: