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?
How to embed a maven dependency with bnd-maven-plugin
Asked Answered
Why are you switching to bnd-maven-plugin if the maven-bundle-plugin already supports your use-case? –
Aristocracy
Well, maven-bundle-plugin is getting out of date with bndlib. bnd-maven-plugin comes from the Bnd maintainers. –
Horwitz
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).
The
lib:=true
will automatically add the jar to the bundle's Bundle-ClassPath
header. –
Horwitz Could you please update your answer to also explain how to include transitive dependencies ? –
Argentite
Sadly, there is no way to specify transitive inclusion natively in bnd. –
Daimyo
© 2022 - 2024 — McMap. All rights reserved.