tags:

views:

531

answers:

3

For reasons of compatibility with an external product, I need to build a RCP application which must include 2 versions of a plugin. The plugin is org.apache.lucene which is currently 1.9.1 in eclipse 3.4. I need version 1.4.103 in order to be compatible with the other application. I should say that my RCP app was originally developed using eclipse 3.2 and after upgrading to 3.4 this problem arose.

During development and test my app worked ok. I had to add the 1.4.103 plugin by hand in the Run configuration but otherwise it ran ok.

Now I am at the Build Product stage and cannot find a way to add the 2 versions of the Lucene plugin in the Configuration tab of the Product wizard. At runtime an error indicates that the 1.4.103 version of Lucene is missing.

+1  A: 

Consider that, in OSGi, bundles have no concept of direct dependence between bundles.
Instead, each bundle lists the services and packages it expects to be registered by other bundles via the "Import-Package" and "Import-Service" headers.

On the opposite side, a bundle lists what services and packages it plans to export via "Export-Package" and "Export-Service". Thus, there are no hard dependencies between bundle implementations. As long as some bundle provides your imported packages your bundle will be happy.

As an illustration, WTP (Web Tools Platform) has Duplicated javax.wsdl plugins:


Now you should make sure you have converted your 3.2 Plugin project with the sub-menu "PDE tools" (right click on your project).

Then you may define an product for your rcp application, in which you will define a configuration (target) for runtime, as opposed to a development target.

VonC
not sure what you mean by 'convert plugin project'. I don't see a convert action in PDE tools menu.
paul
it is when I try to configure the product runtime that I think that I must define which version of the plugin I want to load i.e. 1.4.103
paul
The convert plugin project is only available for old plugin files. If you do not see it, you do not need it. I mentionned it just in case.
VonC
"when I try to configure the product runtime that I think that I must define which version of the plugin I want to load": yes, and probably in the config.ini generated files, at the osgi.bundles line.
VonC
A: 

how about to compile this plugin from source codes under another name? or write a wrapper for older plugin functions to newer?

Imaskar
Absolutely do not do this. OSGi handles multiple versions very well.
+1  A: 

I dug into this issue quite a bit dealing with a product that bundled BIRT, and thus inherited a requirement for the 2 different versions of javax.wsdl. After reading a lot of wiki pages, bugzilla entries, etc., I found that it was a problem in the PDE (Plug-in Development Environment) Build process. The problem has now been corrected in Eclipse 3.5. The bugzilla entry is at https://bugs.eclipse.org/bugs/show%5Fbug.cgi?id=265438.

Basically, Eclipse itself allows you to specify both versions and resolves everything correctly. However, PDE Build (using the same product file) pulls only the newest version of the plug-in. Our solution for the current Eclipse 3.4 base was to forcibly copy the additional plug-in into the plugins folder of the target. This solved our problem for the time being, and we'll migrate to Eclipse 3.5 RCP base in the future to pick up the above noted bug fix.

Steve Robenalt