Eclipse RCP - Use Classes from a library that are imported from another plugin?
Clash Royale CLAN TAG#URR8PPP
Eclipse RCP - Use Classes from a library that are imported from another plugin?
follow situation.
-pluiginCore <- includes many Libraries (libA,liB) via pom.xml, do nothing else
-pluginA..F <- want use classes from libA.
-pluginF..Z <- want use classes from libB.
Is this possible with RCP?
Is this a good way?
Do I need to import via pom.xml libA and LibB in each plugin where I wanna use it?
I added pluginCore as a dependency of pluginA but still cant use libA.
Yes, this is what I try to achieve. For that reason i added libA and libB to pluginCore. After that I add a dependecy to from pluginA to Core in hope that i can use libA.
– user3290745
Aug 8 at 19:31
You don't use maven dependencies for this. It must be done with the MANIFEST.MF directives for this - Bundle-ClassPath, Export-Package, Require-Bundle, Import-Package. The MANIFEST.MF is the only thing the Eclipse plugin system looks at.
– greg-449
Aug 8 at 20:20
1 Answer
1
You have to do this using the directives in the MANIFEST.MF of the plugins.
For the plugin which contains the libraries you use the Bundle-ClassPath
to specifies the jars in the plugin. For example:
Bundle-ClassPath
Bundle-ClassPath: .,
lib/jogg-0.0.7.jar,
lib/jorbis-0.0.15.jar,
lib/vorbisspi1.0.2.jar
The .
entry is for the normal code in the plugin, the other entries are jars in a lib
directory.
.
lib
You must also specify the additional jars in the build.properties
for the plugin.
build.properties
You use the Export-Package
directive to say which packages from these jars are available to other plugins:
Export-Package
Export-Package: com.jcraft.jogg,
com.jcraft.jorbis
Plugins which wish to refer to these packages can either use Require-Bundle
to add a dependency to the plugin exporting the packages, or they can use Import-Package
to let Eclipse find the imported package.
Require-Bundle
Import-Package
Thank you so much
– user3290745
Aug 8 at 21:01
One other thing - if you are using maven look at Eclipse Tycho which provides support for building RCPs and plugins to maven.
– greg-449
Aug 9 at 5:46
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Plugins can only use libraries that are included in plugins, they can't reference external jars.
– greg-449
Aug 8 at 18:23