When is it safe to remove import entries from feature.xml?
I've recently learned that the import section from feature.xml is legacy, and the actual dependency work is delegated to the p2
engine, which uses the information from the plugin manifest.
I am not sure though if p2
is available for all recent versions of Eclipse, or in all Eclipse-based products, so I'm not sure if it is safe to remove the import
section from feature.xml
.
Under what circumstances is it safe to remove the import
section from feature.xml
? Assume that we are taking into c开发者_如何学运维onsideration Eclipse 3.4 or newer.
P2 was introduced in Eclipse 3.4 release. It had quite a few issues in that release, so a way was given to revert your Eclipse install to using the legacy Update Manager. Starting with 3.5 release, p2 is quite stable and is a definite improvement over the old Update Manager. I am not certain if it is possible to revert to the Update Manager in 3.5 or higher release. I certainly haven't heard of anyone doing this.
P2 is present in all Eclipse packages starting with 3.4 release.
I wouldn't categorize feature import as a deprecated feature. You would still want to use it to pull in plugins when you don't have direct OSGi dependency on them.
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.
精彩评论