Search code examples
javatestinggradleosgibnd

Can not run OSGi tests requiring "org.eclipse.pde.core" because of icu4j


I am trying to run some test using the aQute.bnd.gradle.TestOSGi task from bnd.

My library requires org.eclipse.pde.core

Resolution failed. Capabilities satisfying the following requirements could not be found:
    [<<INITIAL>>]
      ⇒ osgi.identity: (osgi.identity=org.eclipse.pde.core)
          ⇒ [org.eclipse.pde.core version=3.13.200.v20191202-2135]
              ⇒ osgi.wiring.bundle: (&(osgi.wiring.bundle=org.eclipse.team.core)(bundle-version>=3.2.0)(!(bundle-version>=4.0.0)))
                  ⇒ [org.eclipse.team.core version=3.8.800.v20191122-2107]
                      ⇒ osgi.wiring.bundle: (&(osgi.wiring.bundle=org.eclipse.compare.core)(bundle-version>=3.5.200)(!(bundle-version>=4.0.0)))
                          ⇒ [org.eclipse.compare.core version=3.6.700.v20191122-2107]
                              ⇒ osgi.wiring.package: (&(osgi.wiring.package=com.ibm.icu.text)(version>=3.6.1))

I have 'com.ibm.icu:icu4j:64.2' as dependency and I even indicated that I would like to start the bundle com.ibm.icu.

-runrequires: \
    bnd.identity;id='${project.archivesBaseName}',\
    bnd.identity;id='junit-jupiter-engine',\
    bnd.identity;id='junit-platform-launcher',\
    bnd.identity;id='org.eclipse.pde.core',\
    bnd.identity;id='com.ibm.icu',\

Minimal reproducer project can be found here: pde-run project on GitHub


I looked at the MANIFEST file inside the icu4j.jar.

I see following:

Bundle-ManifestVersion: 2
Bundle-Name: ICU4J
Bundle-Description: International Components for Unicode for Java
Bundle-SymbolicName: com.ibm.icu
Bundle-Version: 64.2

Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Main-Class: com.ibm.icu.util.VersionInfo
Export-Package: com.ibm.icu.lang,com.ibm.icu.math,com.ibm.icu.number,com.ibm.icu.text,com.ibm.icu.util
Automatic-Module-Name: com.ibm.icu

So com.ibm.icu.text is exported by this bundle.

Is there a way to understand what is going on?

I thought maybe the Bundle-RequiredExecutionEnvironment entry is preventing the bundle to be started (I am using Java 8 for my tests). If this is the case, what can I do to solve my issue?



Solution

  • The unsatisfied requirement is package com.ibm.icu.text with version>=3.6.1. However the export from the copy of icu4j.jar that you have shown is unversioned, which means it has an implicit version of 0.0.0.

    Unfortunately 0.0.0 is not greater than or equal to 3.6.1, therefore this bundle not satisfy the requirement from the org.eclipse.compare.core bundle.