Create a name section (second part of manifest) with optional property expansion and addition of custom attributes.
The key of the -namesection
instruction is an ant style glob. And there are two target groups for matching:
/
or is an exact match for a resource path/
or is an exact match for a package pathThe goal of named sections is to provide attributes over a specific subset of resources and paths in the jar file. Attributes are specified using the same syntax used elsewhere (such as package attributes). Attributes can contain properties and macros for expansion and replacement.
Each attribute is processed by bnd and the matching value is passed using the @
property.
Resources are targeted by using a glob pattern not ending with /
.
For example, the following instruction sets the content type attribute for png
files:
-namesection: com/foo/*.png; Content-Type=image/png
This produces a result like the following:
Name: org/foo/icon_12x12.png
Content-Type: image/png
Name: org/foo/icon_48x48.png
Content-Type: image/png
Packages are targeted by using a glob pattern that ends with /
.
For example, to produce a Java Package Version Information section use an instruction like this one:
-namesection: jakarta/annotation/*/;\
Specification-Title=Jakarta Annotations;\
Specification-Version=${annotation.spec.version};\
Specification-Vendor=Eclipse Foundation;\
Implementation-Title=jakarta.annotation;\
Implementation-Version=${annotation.spec.version}.${annotation.revision};\
Implementation-Vendor=Apache Software Foundation
This produces a result like the following:
Name: jakarta/annotation/
Implementation-Title: jakarta.annotation
Implementation-Vendor: Apache Software Foundation
Implementation-Version: 2.0.0-M1
Specification-Title: Jakarta Annotations
Specification-Vendor: Eclipse Foundation
Specification-Version: 2.0