Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-98289

Update bnd to fix FELIX-6081 to properly calculate osgi.ee for embedded Multi-release JAR dependencies

    Details

    • Fix Priority:
      4

      Description

      https://issues.apache.org/jira/browse/FELIX-6081
      https://github.com/bndtools/bnd/issues/3010
      https://github.com/bndtools/bnd/issues/2227#issuecomment-400039587

      Background
      More and more (transitive) dependencies we use in our modules tend to be "Multi-release JARs" and include "module-info.class" and "META-INF/versions/..." inside the archives.

      BND requires special directives to ignore the Multi-release resources when scanning the JARs otherwise the generated MANIFEST.MF of our module will contain something like this:

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

      1. To ignore META-INF/versions/... you need to add the following to your "bnd.bnd" :

      -fixupmessages: Classes found in the wrong directory: ...;is:=ignore
      

      2. To ignore module-info.class the -fixupmessages directive is not enough: : you also need to add

      -noee: true
      

      unless we upgrade to BND (see the referenced GitHub issues and FELIX ticket above).

      Steps to reproduce

      1. Edit modules/apps/portal-search-elasticsearch6/portal-search-elasticsearch6-impl/build.gradle
      2. Change version to "1.61" for
        compileInclude group: "org.bouncycastle", name: "bcpg-jdk15on", version: "1.59"
        

        Note: "bcpg-jdk15on-1.61.jar will have a "module-info.class" in its root

      1. Run gradlew assemble
      2. Inspect the generated MANIFEST.MF of com.liferay.portal.search.elasticsearch6.impl-*.jar in tools/sdk/dist:

      Expected Result:
      com.liferay.portal.search.elasticsearch6.impl-*.jar#META-INF/MANIFEST.MF contains

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

      Actual Result: com.liferay.portal.search.elasticsearch6.impl-*.jar#META-INF/MANIFEST.MF contains

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

      Add -noee: true to the end of the bnd.bnd of the elasticsearch6-impl module and rebuild. Now the MANIFEST does not contain the problematic Require-Capability.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Days since last comment:
                  2 weeks ago

                  Packages

                  Version Package