Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do we need `Imported Packages` when we have `Required Plug-ins` in Eclipse plugin dependencies?

In developing Eclipse application, the dependencies tab in MANIFEST.MF has two columns.

One is Required Plug-ins and the other is Imported Packages.

Why do we need Imported Packages when we have Required Plug-ins?

The comment has it that "this plug-in depends without explicitly identifying their originating plug-in", but I'm not sure in what case one doesn't want to explicitly identify their originating plug-in, and what's the advantage of it?

enter image description here

ADDED

Related question - What's the difference between Eclipse Packages and Plug-ins?

like image 286
prosseek Avatar asked Dec 19 '12 19:12

prosseek


People also ask

What is meant by plugin in Eclipse?

Plugin , which is an abstract class that provides generic facilities for managing plug-ins. An Eclipse installation includes a plugins folder where individual plug-ins are deployed. Each plug-in is installed in its own folder under the plugins folder. A plug-in is described in an XML manifest file, called plugin.


1 Answers

Importing a package provides an extra level of indirection over requiring a bundle.

Consider the case of some standard API... org.standard.framework. Suppose two companies implement this API, maybe you have bundles com.abc.framework and com.xyz.framework. Both of these implementation bundles would export org.standard.framework package.

Now suppose, you need an org.standard.framework implementation, but you don't particularly care which one. If you require either com.abc.framework or com.xyz.framework bundle, you are tying yourself to a particular implementation. With an import-package directive, you are letting OSGi serve as an indirection layer.

Another advantage of import-package is that your dependencies do not need to change if a package is moved to another bundle. This situation can arise during refactoring when bundles are broken up or combined.

For these reasons, OSGi spec writers now generally recommend using the relatively newer import-package directive over require-bundle. The problem is that not all of the bundles are ready for this. Many do not yet specify a version when exporting a package. This makes import-package impractical in many cases.

like image 118
Konstantin Komissarchik Avatar answered Sep 30 '22 05:09

Konstantin Komissarchik