bnd – the Swiss army knife of OSGi
bnd is the engine behind many popular OSGi development tools, including Eclipse (Bndtools), Maven, Gradle, and the bnd CLI. Its primary function is generating OSGi metadata by analyzing Java class files.
Quick Start Examples
bnd makes it easy to add OSGi metadata to JARs, whether wrapping existing libraries or building your own projects.
# Install bnd CLI (precondition for the other examples)
curl -Lk -o ~/biz.aQute.bnd.jar \
https://bndtools.jfrog.io/artifactory/update-latest/biz/aQute/bnd/biz.aQute.bnd/7.2.1/biz.aQute.bnd-7.2.1.jar
# create alias for easy use via 'bnd'
alias bnd='java -jar ~/biz.aQute.bnd.jar'
# display bnd version to verify installation
bnd version
This installs the bnd CLI and makes the bnd command available in your shell.
Reference: bnd CLI installation | bnd CLI documentation
What is bnd?
bnd consists of two major parts:
-
Manifest generation – Excellent at creating JARs with OSGi metadata based on instructions and the information in class files. Used by Maven, Gradle, Ant, and other build tools.
-
Workspace model – An IDE/build-tool-independent model of a workspace with projects that works identically across Eclipse, Maven, Gradle, and the command line.
“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
How to get started?
The most feature-rich option is the Bndtools Eclipse plugin. There are tutorial videos and an OSGi Starter guide available.
For Maven users, start with the Maven plugins README.
For Gradle users, see the Gradle Plugins README.
The bnd CLI is great for exploration — especially the shell command.