Reputation: 553
I have a requirement to embed a non-osgi third party dependency (nimbus-jose-jwt) for a custom use-case.
I have added the following dependency under the dependencies section in pom file.
<dependency>
<groupId>com.nimbusds</groupId>
<artifactId>nimbus-jose-jwt</artifactId>
<version>5.8</version>
</dependency>
I have tried embedding the third party jar within the bundle using the Embed-Dependency directive.
<Embed-Dependency>
com.nimbusds.jose.*;scope=compile|runtime;inline=true,
com.nimbusds.jwt.*;scope=compile|runtime;inline=true,
</Embed-Dependency>
My maven-bundle-plugin in the pom file looks as follows.
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>
${project.artifactId}
</Bundle-SymbolicName>
<Private-Package>
</Private-Package>
<Import-Package>
</Import-Package>
<Export-Package>
</Export-Package>
<Embed-Dependency>
com.nimbusds.jose.*;scope=compile|runtime;inline=true,
com.nimbusds.jwt.*;scope=compile|runtime;inline=true,
</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
</instructions>
</configuration>
</plugin>
The resulting manifest is correct but the jar is not embedded inside the bundle. What more should I do to have it embedded in my bundle? Appreciate any help on this.
Thanks!
Upvotes: 1
Views: 1540
Reputation: 6853
Try
<Embed-Dependency>*;scope=compile|runtime;inline=true;artifactId=nimbus-jose-jwt</Embed-Dependency>
or
<Embed-Dependency>nimbus-jose-jwt;scope=compile|runtime;inline=true</Embed-Dependency>
The matching expression, at least the first one, matches artifact IDs, not package names. Have a look at the bundle plugin documentation for more info on how to select artifacts for embedding.
Upvotes: 4