“If you want to teach people a new way of thinking, don't bother trying to teach them. Instead, give them a tool, the use of which will lead to new ways of thinking.”
― R. Buckminster Fuller
bnd is the engine behind a number of popular software development tools that support OSGi. It can be found in several maven plugins, ant, gradle, and of course Eclipse (bndtools). It actively seeks other build tool vendors to use bnd to improve the quality of the generated OSGi metadata.
bnd actually consists of 2 major parts, one part is really good in creating a JAR with OSGi meta data based on instructions and the information in the class files. Over time bnd has collected hundreds of heuristics that provide for good bundles. This part is therefore often used in build tools like maven or gradle that already generate JARs. They mainly use the manifest generation features of bnd.
The other part is a IDE/build tool independent model of a workspace with projects. This was the result of the frustration that certain things could be done very well in Eclipse but that other things are best done in a command line tool. Since IDEs are incremental and very event driven, command line tools tend to run everything from start to end. What was needed was an independent model that could work with Eclipse, maven, ant, gradle, and hopefully one day Intellij.
So to use bnd, look at the the descriptions of the tools that include bnd. Then when you want to find out what a certain command does, or how to call a macro, then use this manual.
There are several different ways to get started with bnd. The most elegant one is to start with Bndtools Eclipse IDE. There are a number of videos available that provide a gentle introduction. There is also an accompanying OSGi Starter that provides a lot of detail how to use bnd for larger projects. It includes a Gradle plugin out of the box that will build the Bndtools workspace identical to how things are build inside Eclipse for Continuous Integration with Github Actions or other build servers.
If you insist on using Maven, then you can start with the description of the Maven plugins. You can also go to the OSGi enRoute site; OSGi enRoute is fully based on these Maven plugins.
There is also a Gradle plugin that is the preferred way to build OSGi bundles with plain old vanilla Gradle. This is described in the Gradle Plugins readme.
If you just want to figure out how different commands and macros work, the bnd commandline
is your friend. Especially the shell
command is very useful exploring it.
Last but not least, the whole source code is on GitHub. So feel free to explore it. And when you like, we're very actively taken outside PR's. There is a lot of activity going on.