You can give this [1] a go. It might help you find the inter-dependencies 
between bundles.

[1] - https://github.com/amitjoy/dependency-graph-osgi

Best Regards,
Von: Per-Erik Svensson <per-e...@2c8.com>
Gesendet: Donnerstag, 8. Oktober 2020 17:28 Uhr
An: users@felix.apache.org <users@felix.apache.org>
Betreff: Where do the imports come from: maven-bundle-plugin

Hi all,

I’m currently rewriting an application where we’ve used OSGi and expose a heap 
of packages via “org.osgi.framework.system.packages.extra". This list has grown 
considerably over the years so I would like to shrink it, mainly by 
investigating why we need all these packages. I can obviously figure out which 
bundles that need a specific package by examining the bundle manifest, but 
going further is often a pretty arduous task. The reason is that many of the 
bundles are built with import instructions looking like

<Import-Package>package.we.know.we.need;version=…, *</Import-Package>

Couple this with



And you have a bundle manifest that is really hard to examine when it comes to 
the question “why did maven-bundle-plugin choose to make this package imported”.

So, to my question; Is there any way to get a dependency “path” from one of my 
packages in the bundle to the package in the import-header. I’ve tried both 
jdeps and bnd print -u (and -b) but none of these seem to be able to even find 
all the imports that are made (I particularly don’t understand why bnd print 
wouldn’t get me the result I want since bnd is what maven-bundle-plugin uses). 
I suspect that they don’t look at transitive deps?

In short, is there any tool that you guys use to do something like

prompt> tool find-package-in-bundle-using somepackage

Where “somepackage” is a package generated as an import by maven-bundle-plugin. 
Note that “somepackage” may not be directly used by any package of my bundle 
since it may come from  a package in a library that in turn depends on a 
package in some other library. (This is fairly common when dealing with xml, 
apache-fop, apache-poi and similar “large” libraries.)

Even better of course would be if maven-bundle-plugin could expose its final 
dependency graph somehow (similar maybe to how maven-dependency-plugin’s “tree” 
and “list/resolve” work).

Best regards,


Software developer

+46 (0)54 21 27 28



2conciliate Business Solutions AB

Älvgatan 5, SE-652 25 Karlstad


Reply via email to