OSGi bundle
Thank you for your work. Make the library even better. Discussing version 3.10.1.
JAR not ready for the OSGi environment.
For OSGi 6.0 (on the example Karaf 4.2.8) When deploying JAR as a Bundle we get an error:
org.apache.karaf.features.internal.util.MultiException: Error: Unable to create resource for bundle mvn:com.auth0/java-jwt/3.10.1 at org.apache.karaf.features.internal.download.impl.MavenDownloadManager$MavenDownloader.
(MavenDownloadManager.java:91) at org.apache.karaf.features.internal.download.impl.MavenDownloadManager.createDownloader(MavenDownloadManager.java:72) at org.apache.karaf.features.internal.region.Subsystem.downloadBundles(Subsystem.java:457) at org.apache.karaf.features.internal.region.Subsystem.downloadBundles(Subsystem.java:452) at org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:224) at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:393) at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1062) at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:998) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834) Suppressed: java.lang.Exception: Unable to create resource for bundle mvn:com.auth0/java-jwt/3.10.1 ... Caused by: org.osgi.framework.BundleException: Unable to build resource for mvn:com.auth0/java-jwt/3.10.1: Unsupported 'Bundle-ManifestVersion' value: 1 ... Caused by: org.osgi.framework.BundleException: Unsupported 'Bundle-ManifestVersion' value: 1 ... Error executing command: Error: Unable to create resource for bundle mvn:com.auth0/java-jwt/3.10.1
Need to update META-INF/MANIFEST.MF
When building a JAR, consider the OSGi requirements.
Temporary solution.
When building your project as a bundle, the maven-bundle-plugin is used (by org.apache.felix). Instructions:
<Embed-Dependency>java-jwt;inline=true</Embed-Dependency>Allows you to include the library inside the bundle and work with it.
:wave: Thanks for the report! Currently the workaround you supplied of using the org.apache.felix:maven-bundle-plugin and Embed-Dependency seems to be the best path forward when deploying to an OSGI container.
I'm curious why a workaround is the best path forward? Are there technical limitations to OSGi support? (it can be quite trivial to include the bndtool to generate appropriate manifest headers)
OSGi manifest headers don't do any harm for anyone. So just providing those with the library in the first place is a big advantage.
Should be pretty straightforward to add those with https://github.com/bndtools/bnd/tree/master/biz.aQute.bnd.gradle#gradle-plugin-for-non-bnd-workspace-builds
This feels like a really low-hanging fruit, @kwin is totally right. I was somewhat perplexed when I just found out this library has no OSGi headers.
Team, is there any other workaround to make it work? I'm trying to
Hey @jimmyjames. Will you accept a PR for this?