Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to embed a maven dependency with bnd-maven-plugin

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?

like image 919
empire29 Avatar asked Nov 05 '19 19:11

empire29


1 Answers

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).

like image 127
Ray Avatar answered Nov 20 '22 04:11

Ray