Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maven: Document access to Maven properties in Bnd instructions #5379

Merged
merged 1 commit into from Sep 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions maven/bnd-maven-plugin/README.md
Expand Up @@ -180,6 +180,28 @@ The plugin will by default set some OSGi bundle headers derived from [pom elemen
| `Bundle-Developers` | `developers` (child element `id` must be set on each developer) |
| `Bundle-DocURL` | `url` |

### POM Properties

The Bnd instructions can reference properties defined for the Maven project and Maven settings using the `project.` and `settings.` stems, respectively.
Other properties defined in the POM can also be referenced.

```xml
<properties>
<implementation.vendor>Acme Inc.</implementation.vendor>
</properties>
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
<configuration>
<bnd><![CDATA[
Copy link
Contributor

@kwin kwin Sep 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bjhargrave maybe this is not the best example, as with inline bnd instructions the replacement is actually done by Maven (https://maven.apache.org/ref/3.8.6/maven-model-builder/#model-interpolation). Only for external bnd files it is done by the bnd-maven-plugin IIUC.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps you can make a PR to improve the example?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either split up the example to show both pom.xml and bnd.bnd or get rid of it alltogether I would say. But referencing https://maven.apache.org/ref/current/maven-model-builder/#model-interpolation in this context would be beneficial, as it works similarly.

Implementation-Title: ${project.name}
Implementation-Version: ${project.version}
Implementation-Vendor: ${implementation.vendor}
]]></bnd>
</configuration>
</plugin>
```

### Reproducible Builds

If the configuration parameter `outputTimestamp` is set, indicating [reproducible][1] output, this plugin will automatically use the following Bnd instructions, if not otherwise configured.
Expand Down