You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Per-Erik Svensson <pe...@2c8.com> on 2020/10/08 15:28:58 UTC
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
<Embed-Dependency>*;scope=compile</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
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,
PER-ERIK SVENSSON
Software developer
+46 (0)54 21 27 28
per-erik@2c8.com<ma...@2c8.com>
[Logo-2c8-RGB-400]
2conciliate Business Solutions AB
Älvgatan 5, SE-652 25 Karlstad
www.2c8.com<http://www.2c8.com/>
RE: Where do the imports come from: maven-bundle-plugin
Posted by Per-Erik Svensson <pe...@2c8.com>.
Hi,
Sorry for the late response but I will definitely check it out! Thanks for the help.
Best regards,
Per-Erik Svensson
-----Original Message-----
From: Amit Mondal <ad...@amitinside.com>
Sent: 08 October 2020 23:46
To: users@felix.apache.org
Subject: AW: Where do the imports come from: maven-bundle-plugin
Hi,
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,
Amit
________________________________
Von: Per-Erik Svensson <pe...@2c8.com>
Gesendet: Donnerstag, 8. Oktober 2020 17:28 Uhr
An: users@felix.apache.org <us...@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
<Embed-Dependency>*;scope=compile</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
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,
PER-ERIK SVENSSON
Software developer
+46 (0)54 21 27 28
per-erik@2c8.com<ma...@2c8.com>
[Logo-2c8-RGB-400]
2conciliate Business Solutions AB
Älvgatan 5, SE-652 25 Karlstad
www.2c8.com<http://www.2c8.com/>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
AW: Where do the imports come from: maven-bundle-plugin
Posted by Amit Mondal <ad...@amitinside.com>.
Hi,
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,
Amit
________________________________
Von: Per-Erik Svensson <pe...@2c8.com>
Gesendet: Donnerstag, 8. Oktober 2020 17:28 Uhr
An: users@felix.apache.org <us...@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
<Embed-Dependency>*;scope=compile</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
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,
PER-ERIK SVENSSON
Software developer
+46 (0)54 21 27 28
per-erik@2c8.com<ma...@2c8.com>
[Logo-2c8-RGB-400]
2conciliate Business Solutions AB
Älvgatan 5, SE-652 25 Karlstad
www.2c8.com<http://www.2c8.com/>