Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tycho-user] How to ensure that "import-package" results in getting packages only from bundles specified in "require-bundle"?

I have an Eclipse plugin codebase that uses an ANTLR parser. One (perhaps two) of the several plugins references classes in the antlr packages.

I wasn't able to find the required ANTLR version in a p2 repo, so I have one plugin whose only purpose is to use the "maven-dependency-plugin" to specify the dependencies I need to copy, and I have "build-classpath" entries in the manifest to point to the downloaded jars. I then set this plugin as a dependency of the other plugins that require the ANTLR classes, along with "import-package" to specify the antlr packages required by the plugin.

This seems conceptually correct, but what I'm finding is that if I do a (say) "require-bundle" of bundle "foo" that defines the "" package, along with an "import-package" of "", it's entirely possible that if some other bundle in the Eclipse OSGi runtime container exports the "" package, I could very well get the classes from that other bundle, instead of the bundle I specifically required.

Specifically, I'm finding that the "checkstyle" bundle apparently uses ANTLR and actually exports those packages (for what reason I can't imagine). When the bundle in my application ends up randomly getting those classes from the checkstyle bundle, I end up with "linkage error" fatal errors.

So, is there some way I can specify in my plugin manifest that when I say "import-package" for "", I can specify that I ONLY want to get that package from a specific bundle?

Back to the top