felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard S. Hall" <he...@ungoverned.org>
Subject Re: Maven 2 plugin and Require-Bundle
Date Wed, 04 Oct 2006 13:49:33 GMT
I am not exactly sure what you are saying below.

To be clear, require-bundle and import-package are not equivalent, but 
they certainly overlap. A simple way of looking at require-bundle is 
that it is a shorthand way of importing every package that is exported 
by another bundle, but it a slightly different than this in reality.

Import-package terminates when a class from the package is not found 
(i.e., packages are assumed to be self-contained), while require-bundle 
does NOT terminate when a class from a package is not found, it 
continues searching other required bundles as well as the local bundle 
itself (i.e., packages are assumed to be split).

Although require-bundle seems like a convenience method, it really is 
different and should only be used if you require the functionality that 
it provides. By and large, you should use import-package.

-> richard

Carlos Sanchez wrote:
> I'm very new to osgi :( Thanks to your pointers I've found that
> import-package and require-bundle are equivalent.
> However, require bundle seems to transitively make available all the
> jars in bundled-classpath for all bundles without including those jars
> in my bundle.
> I could set the maven dependencies as provided and then don't get the
> jars in my bundle, but provided dependencies are not transitive in
> maven so I'd need to list all of them. Maybe leave them as compile
> scope and add a config option to set what jars not to include ?
> Thanks
> On 10/4/06, Peter Kriens <Peter.Kriens@aqute.biz> wrote:
>> Could you give an example when the package dependencies would not work
>> and require bundle would?
>> The maven plugin analyzes the bundle for referenced packages. Required
>> bundles should export those packages. The use of require bundle is
>> largely for convenience, it saved you from typing those pesky import
>> package statements. However, with the plugin this not an issue.
>> The advantage of import packages is that you get substitutability, if
>> you later decide to layout your bundles in a different way, or someone
>> decides to write an adapter for a different environment, things still
>> work.
>> Just curious.
>> Kind regards,
>>      Peter Kriens
>> CS> Hi,
>> CS> I've tried the felix maven 2 plugin to build an Eclipse plugin 
>> and saw
>> CS> that there's no way to set the Require-Bundle from the dependencies.
>> CS> I'm looking for the possibility of saying that some of the deps are
>> CS> part of Require-Bundle and then don't include the jars in the result
>> CS> osgi bundle, nor in the Bundle-Classpath.
>> CS> Are my assumptions wrong? if not i'm gonna work on it and contribute
>> CS> it back if it's of interest.
>> CS> Thanks
>> -- 
>> Peter Kriens                              Tel +33467542167
>> 9C, Avenue St. Drézéry                    AOL,Yahoo: pkriens
>> 34160 Beaulieu, France                    ICQ 255570717
>> Skype pkriens                             Fax +1 8153772599

View raw message