6

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?

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
  • 1
    Well, 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 Answers1

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