Expected Behaviour
We implemented a bundle containing the Require-Capability header for consuming a ServiceLoader, where there are multiple bundles providing the ServiceLoader. The analyser should not complain about this
Actual Behaviour
Following warning is thrown:
[WARNING] [requirements-capabilities] be.orbinson.aem:aemaacs-opentelemetry-instrumentation.core:1.0.2-SNAPSHOT: Artifact be.orbinson.aem:aemaacs-opentelemetry-instrumentation.core:1.0.2-SNAPSHOT requires [be.orbinson.aem.aemaacs-opentelemetry-instrumentation.core/1.0.2.SNAPSHOT] osgi.serviceloader; osgi.serviceloader=io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider; filter:="(osgi.serviceloader=io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider)"; cardinality:=multiple; resolution:=mandatory in start level 20 but there is more than one matching capability in this start level: [BundleInfo [symbolicName=be.orbinson.osgi.opentelemetry-exporter-logging, version=1.43.0.0001], BundleInfo [symbolicName=be.orbinson.osgi.opentelemetry-exporter-otlp, version=1.43.0.0001]] (be.orbinson.aem:aemaacs-opentelemetry-instrumentation.all:1.0.2-SNAPSHOT|be.orbinson.aem:aemaacs-opentelemetry-instrumentation.minimal:1.0.2-SNAPSHOT)
Reproduce Scenario (including but not limited to)
Checkout the following project and compille the code: https://github.com/orbinson/aemaacs-opentelemetry-instrumentation/tree/feature/upgrade-cardinality
To create the Require-Capability header, bnd-maven-plugin is used and the the @ServiceConsumer annotation is added to the class that requires the ServiceLoader service to be available:
https://github.com/orbinson/aemaacs-opentelemetry-instrumentation/blob/feature/upgrade-cardinality/core/src/main/java/be/orbinson/aem/opentelemetry/core/services/impl/OpenTelemetryFactoryImpl.java#L32
Apache Aries SpiFly is used to enable ServiceLoader in OSGi:
https://github.com/orbinson/aemaacs-opentelemetry-instrumentation/blob/feature/upgrade-cardinality/opentelemetry-okhttp-exporter/pom.xml#L215
Expected Behaviour
We implemented a bundle containing the Require-Capability header for consuming a ServiceLoader, where there are multiple bundles providing the ServiceLoader. The analyser should not complain about this
Actual Behaviour
Following warning is thrown:
[WARNING] [requirements-capabilities] be.orbinson.aem:aemaacs-opentelemetry-instrumentation.core:1.0.2-SNAPSHOT: Artifact be.orbinson.aem:aemaacs-opentelemetry-instrumentation.core:1.0.2-SNAPSHOT requires [be.orbinson.aem.aemaacs-opentelemetry-instrumentation.core/1.0.2.SNAPSHOT] osgi.serviceloader; osgi.serviceloader=io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider; filter:="(osgi.serviceloader=io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider)"; cardinality:=multiple; resolution:=mandatory in start level 20 but there is more than one matching capability in this start level: [BundleInfo [symbolicName=be.orbinson.osgi.opentelemetry-exporter-logging, version=1.43.0.0001], BundleInfo [symbolicName=be.orbinson.osgi.opentelemetry-exporter-otlp, version=1.43.0.0001]] (be.orbinson.aem:aemaacs-opentelemetry-instrumentation.all:1.0.2-SNAPSHOT|be.orbinson.aem:aemaacs-opentelemetry-instrumentation.minimal:1.0.2-SNAPSHOT)Reproduce Scenario (including but not limited to)
Checkout the following project and compille the code: https://github.com/orbinson/aemaacs-opentelemetry-instrumentation/tree/feature/upgrade-cardinality
To create the Require-Capability header,
bnd-maven-pluginis used and the the@ServiceConsumerannotation is added to the class that requires the ServiceLoader service to be available:https://github.com/orbinson/aemaacs-opentelemetry-instrumentation/blob/feature/upgrade-cardinality/core/src/main/java/be/orbinson/aem/opentelemetry/core/services/impl/OpenTelemetryFactoryImpl.java#L32
Apache Aries SpiFly is used to enable
ServiceLoaderin OSGi:https://github.com/orbinson/aemaacs-opentelemetry-instrumentation/blob/feature/upgrade-cardinality/opentelemetry-okhttp-exporter/pom.xml#L215