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>
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
Similar plugins exist for JPA and Hibernate, and custom plugins can be written to support other configuration formats or scripting languages.