OSGi Software Development: Bnd and Bndtools

Tooling to Build OSGi Bundles Including Eclipse, Maven, and Gradle Plugins

Bnd provides a library for building OSGi bundles along with plugins for use in Gradle and Maven development workflows.

Bndtools is a set of Eclipse plugins which support using Bnd in the Eclipse IDE.

Build Models

Bnd supports a Bnd Workspace build model. This model has projects building bundles located in the root of the workspace alongside a special cnf project. The cnf project represents the configuration of the overall Bnd Workspace. This model is fully supported by the Bnd Gradle plugins as well as the Bndtools plugins for the Eclipse IDE.

Bnd also supports the native build models of Gradle and Maven when using the Bnd plugins for those environments. The Bndtools plugins for the Eclipse IDE also work with the Eclipse m2e project to provide support for the Maven build model in Eclipse.

Bnd

Bnd underlies many, if not most, tools which generate OSGi bundles. Bnd supplies an API which handles OSGi metadata generation and management as well as Jar file creation and manipulation, and API baselining in support of Semantic Versioning. Bnd is used by the Bndtools Eclipse plugins, the Bnd Gradle plugins, and the Bnd Maven plugins.

Bnd is also available as a command line tools which can be installed. On macOS systems, it can be installed via brew install bnd.

Eclipse

Bndtools provides deep support for OSGi developing in the Eclipse IDE. When using the Bnd Workspace model or Eclipse m2e, Bndtools provides live coding support such that modifying a source file will regenerate and redeploy the OSGi bundle into the running OSGi framework.

Gradle

Bnd includes Gradle plugins for Gradle users to build Bnd projects in Bnd Workspace builds as well as in non-Bnd Workspace builds. A typical Gradle build is a non-Bnd workspace build. A Bnd Workspace build uses the information specified in the Bnd Workspace’s cnf/build.bnd file and each project’s bnd.bnd file to configure the Gradle projects and tasks.

The Bnd Gradle plugins define tasks which can add OSGi metadata to jar files being built, index the OSGi metadata from a set of bundles, resolve a set of bundles to a complete OSGi system, API baseline a bundle, export a set of bundles to an executable jar, integration test bundles in an OSGi framework, and run bundles in an OSGi framework for live coding.

Maven

Bnd includes Maven plugins which can add OSGi metadata to jar files being build, index the OSGi metadata from a set of bundles, API baseline a bundle, export a set of bundles to an executable jar, resolve a set of bundles to a complete OSGi system, integration test bundles in an OSGi framework, run bundles in an OSGi framework for live coding, and generate detailed reports on an OSGi bundle.

Open Source

Bnd and Bndtools are fully open source available at GitHub. The Bnd jars, including the Bnd Gradle and Maven plugins, are available from Maven Central and Bndtools is available from the Eclipse Marketplace. The latest development snapshots are also available, to test the newest features.