When building an Eclipse plugin (lato sensu) which consists of multiple plugins and one feature, I have two ways of specifying dependencies:
Require-Bundle
and Import-Package
in META-INF/MANIFEST.MF
;feature.xml
file from the feature.In my understanding, it should be enough to declare the dependencies at the lower level, i.e. in the plugins. Why do we still have the feature.xml
requires
mechanism?
Update: feature.xml description in the Eclipse Help
It is incorrect to categorize feature-to-feature dependency mechanism as legacy. While it is certainly true that with advent of p2, dependencies specified via bundle manifest Require-Bundle or Import-Package will be installed, the result may not be what you expect.
Consider the case where you are building an extension to JDT. Say you only depend on JDT core api (no UI extensions). If you only rely on OSGi dependencies, when your plugin is installed, p2 will dutifully install JDT core bundle, but not the UI bundle. Perfectly fine from OSGi perspective, but probably not what you intended.
I recommend sticking with feature import to describe your high level dependencies to make sure that they are installed in full. Relying only on OSGi dependencies works best for free-floating bundles that aren't part of something bigger that should be installed as a unit.
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