In my osgi project I have maven-bundle-plugin with instructions to import some path, for example: org.blah.blah.* And I have two other bundles that export such package. How to configure my bundle to import org.blah.blah.* from both of them?
This header declares the external dependencies of the bundle that the OSGi Framework uses to resolve the bundle. Specific versions or version ranges for each package can be declared.
OSGi facilitates creating and managing modular Java components (called bundles) that can be deployed in a container. As a developer, you use the OSGi specification and tools to create one or more bundles. OSGi defines the lifecycle for these bundles. It also hosts them and supports their interactions in a container.
OSGi is a Java framework for developing and deploying modular software programs and libraries. Each bundle is a tightly coupled, dynamically loadable collection of classes, jars, and configuration files that explicitly declare their external dependencies (if any).
You can't import a given package name from more than one bundle. What you could do is Require-Bundle both bundles which will give your bundle access to both packages as a split package with all the inherent issues of split packages and Require-Bundle. See 3.13.3 in the OSGi Core Release 5 spec.
Better would be to refactor (if you can) to avoid split packages.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With