# Bnd-maven-plugin handling

**URL:** <https://bnd.discourse.group/t/bnd-maven-plugin-handling/66>\
**Category:** DEVELOPMENT\
**Created:** [January 6, 2021, 2:54pm UTC](https://bnd.discourse.group/t/bnd-maven-plugin-handling/66 "2021-01-06T14:54:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MaHo](https://yyz2.discourse-cdn.com/free1/user_avatar/bnd.discourse.group/maho/32/27_2.png) [@MaHo](https://bnd.discourse.group/u/MaHo)\
**Post date:** [January 6, 2021, 2:54pm UTC](https://bnd.discourse.group/t/bnd-maven-plugin-handling/66/1 "2021-01-06T14:54:22Z")

</div>

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:

```auto
<pluginManagement>
			<plugins>
			<!-- Use the bnd-maven-plugin and assemble the symbolic names -->
				<plugin>
					<groupId>biz.aQute.bnd</groupId>
					<artifactId>bnd-maven-plugin</artifactId>
					<version>${bnd.version}</version>
					<configuration>
						<bnd><![CDATA[
Bundle-SymbolicName: ${project.artifactId}
-sources: true
-contract: *
]]></bnd>
				</configuration>
					<executions>
						<execution>
							<goals>
								<goal>bnd-process</goal>
							</goals>
						</execution>
					</executions>
				</plugin>

```

In my project pom I also provide:

```auto
<build>
        <plugins>
            <plugin>
                <groupId>biz.aQute.bnd</groupId>
                <artifactId>bnd-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

```

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,  
Mark

---

<div class="post-metadata">

**Author:** ![bjhargrave](https://yyz2.discourse-cdn.com/free1/user_avatar/bnd.discourse.group/bjhargrave/32/10_2.png) [@bjhargrave](https://bnd.discourse.group/u/bjhargrave)\
**Post date:** [January 6, 2021, 3:37pm UTC](https://bnd.discourse.group/t/bnd-maven-plugin-handling/66/2 "2021-01-06T15:37:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MaHo](https://yyz2.discourse-cdn.com/free1/user_avatar/bnd.discourse.group/maho/32/27_2.png) [@MaHo](https://bnd.discourse.group/u/MaHo)\
**Post date:** [January 6, 2021, 3:40pm UTC](https://bnd.discourse.group/t/bnd-maven-plugin-handling/66/3 "2021-01-06T15:40:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rotty3000](https://yyz2.discourse-cdn.com/free1/user_avatar/bnd.discourse.group/rotty3000/32/16_2.png) [@rotty3000](https://bnd.discourse.group/u/rotty3000)\
**Post date:** [January 6, 2021, 3:55pm UTC](https://bnd.discourse.group/t/bnd-maven-plugin-handling/66/4 "2021-01-06T15:55:37Z")

</div>

The parent pom can certainly safely define the bnd-maven-plugin with defaults: see here [https://github.com/osgi/osgi-test/blob/main/pom.xml#L121-L145](https://github.com/osgi/osgi-test/blob/main/pom.xml#L121-L145)

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.

---

<div class="post-metadata">

**Author:** ![bjhargrave](https://yyz2.discourse-cdn.com/free1/user_avatar/bnd.discourse.group/bjhargrave/32/10_2.png) [@bjhargrave](https://bnd.discourse.group/u/bjhargrave)\
**Post date:** [January 6, 2021, 3:57pm UTC](https://bnd.discourse.group/t/bnd-maven-plugin-handling/66/5 "2021-01-06T15:57:06Z")

</div>

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 [https://github.com/bndtools/bnd/tree/master/maven/bnd-maven-plugin#bnd-instruction-inheritance](https://github.com/bndtools/bnd/tree/master/maven/bnd-maven-plugin#bnd-instruction-inheritance).

---

<div class="post-metadata">

**Author:** ![MaHo](https://yyz2.discourse-cdn.com/free1/user_avatar/bnd.discourse.group/maho/32/27_2.png) [@MaHo](https://bnd.discourse.group/u/MaHo)\
**Post date:** [January 6, 2021, 4:02pm UTC](https://bnd.discourse.group/t/bnd-maven-plugin-handling/66/6 "2021-01-06T16:02:57Z")

</div>

Thank you very much for clarifying that.
