Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The remainder of this section covers the most important aspects of BND's instructions; for complete details refer to the BND documentation.

Anchor
instructions
instructions

Instructions

<Export-Package>

The <Export-Package> instruction is a list of packages for the bundle to export. These packages are copied into the resulting bundle JAR file from the available classes (i.e., project classes, dependencies, and class path); thus, your it is possible to include classes not associated the source files in your project. <Export-Package> can be specified with package patterns using the '*' wildcard. Also, it is possible to exclude packages with negation by starting the package pattern with '!'. Thus, non-negated patterns indicate which of the available packages to include in the bundle, whereas negated patterns indicate which should not be included in the bundle. Currently, the list is ordered and earlier patterns take effect before later patterns (we are planning on changing this in the future so that order is not important).

Following standard OSGi R4 syntax, package patterns can include both directives and attributes, which will be copied appropriately into the generated Export-Package manifest header. The version of packages is determined by examining the source JAR file or from packageinfo files in the package directory.

  • <Private-Package>
  • <Include-Resource>
  • <Import-Package>

Anchor
default-behavior
default-behavior

...

  • <Bundle-SymbolicName> is assumed to be "${groupId}.${artifactId}".
  • <Export-Package> is assumed to be "${groupId}.${artifactId}.*", which copies everything under the project package root into the bundle and exports it.
  • <Import-Package> is assumed to be "*", which imports everything else not in the bundle.
  • <Include-Resource> is assumed to be "src/main/resources/", which copies the hierarchical contents of this directory into the bundle.
  • <Bundle-Version> is assumed to be "${pom.version}" with '-' characters replaced with '.' characters.
  • <Bundle-Name> is assumed to be "${pom.name}".
  • <Bundle-Description> is assumed to be "${pom.description}".
  • <Bundle-License> is assumed to be "${pom.licenses}".
  • <Bundle-Vendor> is assumed to be "${pom.organization}.

...

  • ".

Since the plugin creates bundles for OSGi R4, it hard codes Bundle-ManifestVersion to be '2'. Additionally, it generates imports for every export to ensure package substitutability, which is very important when working with collaborating services. It is possible to override any of these values (except Bundle-ManifestVersion) just by specifying the desired value in the plugin configuration section of the POM file.

Anchor
how-to
how-to

Detailed "How To"