In most cases it is best to have one project generate one bundle. However, sometimes it creates a lot of overhead and you’d like to be able to provide multiple bundles in a project since they share so much information.
In bnd, you can enable sub bundles. The -sub
instruction can list these bundles, wildcards are allowed.
-sub *.bnd
The Bundle Symbolic Name for each sub bundle will be the name of the project + ‘.’ + the name of the sub bundle. For example, a sub bundle foo.bar
in project com.example
will be called com.example.foo.bar
.
Sub bundles are mostly treated as independent projects. They are part of the repositories and release process.
A case where I find them generally useful is when I provide an implementation and want to separate the Gogo commands from the main code. In that case I create a main provider bundle and a Gogo bundle.