Hi all

Recently, I updated my maven-bundle-plugin from 2.1.0 to latest 2.3.7, and
I observed a change in the list of imported packages.

I have 2 different uses case:
1. Wrapping an existing library (say one of the commons-*) and thus
exporting all of its packages
2. Creating a Bundle of our own with an API package and an implementation
package, but with both packages exported (no services around here, so it's
mostly like a library, but with an API)

So the change was that the exported packages were usually automatically
imported, and it's no more the case.

After digging in Bnd, I found the following issue:
https://github.com/bndtools/bnd/issues/6

... that looks related to that part of bnd:
https://github.com/bndtools/bnd/blob/master/biz.aQute.bndlib/src/aQute/lib/osgi/Analyzer.java#L954

The comment is quite instructive and reasonable, but I see a difference in
the comment and in the real implementation.
The comment say: "there must be a contained package that refers to the
exported package for it to make use importing that package"
But the implementation do:
// private packages = contained - exported.
Set<String> privatePackages = new HashSet<String>(contained.keySet());
privatePackages.removeAll(exports.keySet());

The implementation do not take care of "contained" packages but only looks
for "private" packages (that is contained - exported).

In both of my use cases, as I export everything, contained == exported so I
have no private packages and therefore, not a single exported package is
also automatically imported.

So finally the question, what is the reasonning to restrict to private
packages instead of contained packages ?

I may agree that for the library wrapping use case, no substitution is not
necessarily bad, as if 2 exported packages are equivalent, only the first
one will be wired to (except if there is a Require-Bundle for this exact
Bundle).
But for the other case, I really want my api packages to be also imported,
well that's an API ...

Thanks
--Guillaume
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to