I am moving from maven-bundle-plugin which provided the "convenient" configuration using Embed-Dependency, but it appears i need to specify my Embed Dependency "manually" in bnd format when using the bnd-maven-plugin
. I added the same bundle headers from my old package, but it doesn't seem to be including the actual dependency's jar file. Does someone have a quick/concise how-to do this?
Asked
Active
Viewed 3,820 times
6

empire29
- 3,729
- 6
- 45
- 71
-
Why are you switching to bnd-maven-plugin if the maven-bundle-plugin already supports your use-case? – gjoranv Nov 07 '19 at 21:31
-
1Well, maven-bundle-plugin is getting out of date with bndlib. bnd-maven-plugin comes from the Bnd maintainers. – BJ Hargrave Nov 08 '19 at 21:45
1 Answers
5
bnd has an instruction -includeresource
defined here https://bnd.bndtools.org/instructions/includeresource.html:
Here's an example:
-includeresource: lib/somelib.jar=somelib-[\w.]*.jar;lib:=true
This should have visibility into all the dependencies in the classpath used to build the artifact and matches on the file name of the associated files.
[Update with BJ's comment]
The lib:=true
will automatically add the jar to the bundle's Bundle-ClassPath header in a merge safe way (i.e. by making sure it plays nice with existing content or non-existent value).

Ray
- 1,324
- 10
- 18
-
The `lib:=true` will automatically add the jar to the bundle's `Bundle-ClassPath` header. – BJ Hargrave Nov 08 '19 at 21:44
-
Could you please update your answer to also explain how to include transitive dependencies ? – user2668735 Nov 07 '22 at 17:13
-