Bnd-maven-plugin handling

Happy new year to all of you!!!

I have a question about the behavior of the bnd-maven-plugin (version 5.2). I configured the bnd-maven-plugin in the parent pom like this:

			<!-- Use the bnd-maven-plugin and assemble the symbolic names -->
Bundle-SymbolicName: ${project.artifactId}
-sources: true
-contract: *

In my project pom I also provide:


With this setup, the bsn’s end up correctly in the manifest.

When I also have a bnd-maven-plugin definition in the parent pom’s build section, like in the project, then all bundles will have the bsn from the parent artifact.

Somehow I expected, that the build plugin definition in the project overwrites the build plugin definition from the parent pom? But in that case the project definition has no effect, if also a build plugin section for bnd-maven-plugin in the parent pom.

Is this behavior by intention? If yes is there a reason for that?

Thank you,

That is normal. The bnd-maven-plugin inherits the configuration from the parent pom which is typical for maven plugins. So generally you would not want to the parent pom to actually make a bundle.

Maybe we should leave a notice/warning somewhere, to take care not having a bnd-maven-plugin definition in the parents pom, so that no one accidentially gets unwanted data in the manifest e.g.

The parent pom can certainly safely define the bnd-maven-plugin with defaults: see here

This issue is when certain values in the configuration are interpolated. That’s what you have to be careful with. Both maven and bnd use the same syntax for interpolation AND the inline bnd configuration will be interpolated by maven before it reaches bnd so that’s the gotcha you need to prepare for.

But that is true for all maven plugins. For example, if your parent pom configures the maven-jar-plugin to add data to the manifest, then all child poms using the maven-jar-plugin will inherit that configuration. There is nothing special in this regard about the bnd-maven-plugin.

Also see

Thank you very much for clarifying that.