How to add "Embedded-Artifacts" section to Manifest using gradle bnd (bndtools)?

481 views Asked by At

I am converting the build of a bunch of OSGi bundles from Maven builds to Gradle. Part of the build includes using Bnd to embed some jars into the generated jar, as well as generate specific headers in the manifest file.

The incumbent Maven build uses the "maven-bundle-plugin" to achieve this. The plugin has an Embed-Dependency feature which appears to take the desired dependencies and embed them (as jars) in the generated jar. It also places headers in the manifest file: Bundle-ClassPath and Embedded-Artifacts. There are other de facto headers, but the two I've specified are the ones causing issues when trying to get the Gradle output to match that from Maven.

I have been able to achieve a portion of this with plain Bnd (bndtools) and Gradle,

For example, this bnd instruction:

-includeresource: docker-java-core-3.2.5.jar; lib:=true

will embed the jar docker-java-core-3.2.5.jar and add it to the Bundle-ClassPath manifest header. I haven't found a way for Bnd to include transitive depdencies, so I specify those manually, which is fine.

However, I'm unable to find a way (using plain Bnd) to add the jars to the manifest section Embedded-Artifacts which is generated by the Maven build.

This section appears in the Manifest with this format:

Embedded-Artifacts: docker-java-core-3.2.5.jar;g="com.github.docker-java";a="docker-java-core";v="3.2.5"

I'd like to produce the same using Bnd (Bndtools) through Gradle.

[edit] The comments indicate that this header is unnecessary, and isn't part of the OSGi specifications. Why might it be included, if this is the case? [/edit]

0

There are 0 answers