Jack
Jack

Reputation: 455

How to import same package from different osgi bundles?

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?

Upvotes: 8

Views: 1498

Answers (1)

BJ Hargrave
BJ Hargrave

Reputation: 9384

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.

Upvotes: 11

Related Questions