5.2 Manifest Template Format

The following table lists the headers you can add to the manifest template, in addition to the standard manifest headers.

Table 5.1. Headers for Manifest Template

HeaderDescription
Excluded-Exports A comma-separated list of packages that must not be added to the manifest's Export-Package header.
Excluded-Imports By default, Bundlor adds imports for every package that Bundlor determines is referenced by the code or for special files in the jar. Use this header to specify a comma-separated list of packages for which imports Bundlor will not generate.
Export-Template By default, Bundlor versions all exported packages at the specified Bundle-Version. Use this header to specify that individual exported packages be exported at different versions. For example, Export-Template com.foo.*;version="1.5" results in Bundlor versioning any Export-Package entries for com.foo or its subpackages at 1.5.
Ignored-Existing-Headers If the JAR for which you are generating a manifest already contains an OSGi-compliant manifest, use this template header to list headers in the original manifest which Bundlor should ignore.
Import-Template Use this header to augment package imports that Bundlor generates via bytecode and special file analysis. Typically you use the header to version the import and, in some cases, to mark them as optional. When you use this header to version the import, you can optionally specify a version expansion pattern so that Bundlor sets the version to a range rather than a single version. To use the header, set its value to a comma-separated list of package names and attributes.
Version-Patterns Use this header to declare one or more version expansion patterns and give each one a name. You can then use these named patterns in the Import-Template header if you want to specify an expansion pattern for the version of an imported package. This feature is described in detail later in this section.

A wilcard '*' at the end of the package name is supported to match multiple packages. For example, the header Import-Template: com.foo;version=[1.0,2.0);resolution:=optional,com.bar.*;version="[1.5,1.6)" will cause any import generated for the com.foo package to be versioned at 1.0 (inclusive) to 2.0 (exclusive) and to be considered optional, and for any import of com.bar or its sub-packages to be versioned at 1.5 (inclusive) to 1.6 (exclusive).