This website and its associated repositories, are deprecated and no longer supported by the OSGi Alliance. Please visit https://enroute.osgi.org for the latest supported version of OSGi enRoute.
This enRoute v2 archive site is kept for those who do not intend to use the latest version of OSGi enRoute. If you are new to OSGi enRoute, then please start with the latest OSGi enRoute.
Bnd discovers package dependencies in a bundle by scanning the bytecode
of the compiled Java files. This process finds all of the static
dependencies of the Java code, but it does not discover dynamic
dependencies, for example those arising from the use of
Class.forName()
. There is no generic way for Bnd to calculate all
dynamic dependencies. However there are certain well-known configuration
formats that result in dynamic dependencies, and Bnd can analyse these
formats through the use of plugins.
For example, some bundles use the Spring Framework for dependency injection. Spring uses XML files that refer to fully qualified Java class names:
<bean id="myBean" class="org.example.beans.MyBean">
</bean>
Here the org.example.beans
package is a dependency of the bundle that
should be added to Import-Package
. Bnd can discover this dependency by
adding a Spring analyser plugin via a declaration in the descriptor
file:
-plugin: aQute.lib.spring.SpringComponent
Similar plugins exist for JPA and Hibernate, and custom plugins can be written to support other configuration formats or scripting languages.