Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsSeparation of Java and Eclipse Worlds
https://www.eclipse.org/forums/index.php/mv/msg/162164/512716/#msg_512716
Is there a way to use a plain java library/jar without exposing it through a plugin? Or an easier way to expose a jar without rebuilding the plain java library (which is also used outside the eclipse world) for those projects and then also rebuilding the Eclipse plugin?
Is there a method of making Java SPI work? In the past I've worked around this by using Eclipse extension points - but it feels more difficult than it should be.
In general I feel I've been burned many times by the way Eclipse class loading works - maybe I'm missing some fundamental details. Are there any good articles that address the differences between OSGI/Eclipse loading and regular java class loaders, or explain how eclipse loading works in detail?
Thanks,
Jared]]>Jared2010-02-06T18:01:04-00:00Re: Separation of Java and Eclipse Worlds
https://www.eclipse.org/forums/index.php/mv/msg/162164/513001/#msg_513001
there are probably another set that deal specifically with Eclipse and
classloading (extension points, etc).
The fundamental statement for OSGi is "bundles can only see other
bundles". You either have to require another bundle (promoted mostly be
eclipse) or import the other bundles packages (which it exports,
favoured in the OSGi world).
How to manage them depends on your scenario: Are you developing the 3rd
party jar and the eclipse plugin together? Are you simply consuming a
3rd party jar (org.apache.commons.lang-2.4.0.jar)?
If you want to work on a java project that should also be consumed as an
OSGi bundle, that's easy to set up in eclipse (SWT is like that, and is
usable from within eclipse both for a java app and as a plugin library).
If you want to consume a generic java project that doesn't use
reflection, then you have 2 choices ... either turn the jar into a
bundle (by adding the appropriate OSGi MANIFEST.MF entries) or create a
bundle that includes the jar in question and exports it appropriately.
Option 1 changes the 3rd party jar (although not much) and option 2 you
aren't modifying the 3rd party jar.
If you want to consume a java library that uses reflection, that's
harder ... it depends on a flat classpath, but OSGi provides modularity
imposed on the classpath. Then you have to pick the appropriate
workaround for the type of java library that it is (and it really
depends on what the java library is trying to do).
Extension points allow contributors to extend a bundles basic
functionality (and handle the classloading for you). In the OSGi world
I would imagine you get the same effect from implementing a common
interface and having contributors register their contributions as a
service (the whiteboard pattern is the common example I can think of).
I know this is more of a rambling description rather than a clear answer
to your question, but it really does depend on which OSGi vs Java
library problem you are trying to solve.