non-osgi jars: embedded in bundle or in plugin directory? [message #512165] |
Thu, 04 February 2010 04:33  |
Eclipse User |
|
|
|
We created a core system which makes use of 74 external jar libraries which we want to use in Eclipse RCP. It is not GUI specific.
We would like to start with the "one big bundle" approach of getting this core system to work, instead of having to OSGi-ify our core system and find OSGi bundles for our dependencies. (Later we should probably remove unneeded external dependencies and OSGI-ify our own system)
We can use Maven (with the bundle plugin) to create an OSGi bundle.
I already have successfully done this, but when I tell it to unpack all external jars before creating the bundle, the bundle jar will be in a big mess: resource files for different specific jars get into the root directory of the bundle and for example many LICENSE.TXT files are dropped because there can be only one such file.
The other option is to embed the jars inside the bundle (jars within a jar), which gives a very clean bundle jar. (Disadvantage: not usable outside of OSGi). This also seems to work, until the code in our own Eclipse plugin explicitly need access to a class from an embedded jar. Although this class is exported by the bundle and the jar is on the bundle classpath, the Eclipse compiler tells it can not find the class! Shouldn't this be supported by OSGi?
Am I doing something wrong here, or is this the usual behavior?
The last and probably currently best approach I can think of is to create a bundle which does not contain the jars but uses a "lib" directory for the external jars. Is this an official OSGi way? Or would this automatically mean we have to turn it into an Eclipse Plugin which can only be used by Eclipse? In this case, do we need to have a plugin.xml file?
[Updated on: Thu, 04 February 2010 04:36] by Moderator
|
|
|
|
|
|
|
|
|
Re: non-osgi jars: embedded in bundle or in plugin directory? [message #1828515 is a reply to message #713874] |
Thu, 11 June 2020 04:41  |
Eclipse User |
|
|
|
I know this is an old post, but maybe I can help other people searching about this.
I need to "add" a plugin named B to a pre-existing plugin from a p2 repository named A. The A plugin looks for a license file that I want to put inside my B plugin, but A needs to have the license file in its classpath.
I cannot edit A plugin easily so I tried to add B as a fragment plugin, and it works ok. I can add my license file (or classes to be instantiated by class.forName, I suppose) to my B plugin, and it works like a charm.
About adding a lot of jars inside a plugin, take care about it because maybe it will take a lot of time to find classes inside this "jars-inside-jar" structure. If you use the profiler you can see the big time it uses unzipping jars.
|
|
|
Powered by
FUDForum. Page generated in 0.05865 seconds