Eclipse RCP: Problem creating product which needs 2 different versions of a plugin

孤人 提交于 2019-12-12 19:17:08

问题


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:


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.




回答2:


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_bug.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.




回答3:


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



来源:https://stackoverflow.com/questions/479254/eclipse-rcp-problem-creating-product-which-needs-2-different-versions-of-a-plug

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!