问题
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