Building an OSGI plugin bundle(with transitive dependencies) using Maven on Eclipse

允我心安 提交于 2019-12-24 20:16:15

问题


I am running an application using an OSGI framework and run configuration on eclipse.I am developing a plugin to add to the main application. However, the plugin bundle has a load of transitive dependencies, some of which are OSGI bundles and some are not. However it looks like the OSGI framework expects all the dependencies to be OSGI bundles. It is a huge pain to convert all third party transitive dependencies into OSGI bundles. I was trying to embed all transitive dependent jars into the one single fat OSGI bundle for the plugin using maven-shade-plugin, but it's just not working. The OSGI bundle loader keeps looking for OSGI bundles while loading transitive dependencies.

I can see that swrlapi.jar is embedded within the plugin bundle when the shading process occurs. [INFO] Including edu.stanford.swrl:swrl-api.2.0.6.jar in the shaded jar

However, when I launch the application and switch to the tab that invokes the plugin's code; I get the following error used by:

java.lang.ClassNotFoundException: org.swrlapi.factory.SWRLAPIFactory cannot be found by HTA-Basic_1.0.0.SNAPSHOT
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:511) ~[na:na]
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422) ~[na:na]
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:414) ~[na:na]
    at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:153) ~[na:na]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_181]

Please help.

来源:https://stackoverflow.com/questions/54586595/building-an-osgi-plugin-bundlewith-transitive-dependencies-using-maven-on-ecli

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!