Bug 367187 - [patch] Product validation doesn't find plugin needed in two versions
Summary: [patch] Product validation doesn't find plugin needed in two versions
Status: VERIFIED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: PC Windows XP
: P3 major with 6 votes (vote)
Target Milestone: 4.5 M2   Edit
Assignee: George Suaridze CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
: 443927 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-12-20 08:44 EST by Helmut Frohner CLA
Modified: 2018-09-25 08:36 EDT (History)
10 users (show)

See Also:


Attachments
Patch to support two or more versions of bundle with same id in feature-based product (5.89 KB, patch)
2014-08-10 05:44 EDT, George Suaridze CLA
no flags Details | Diff
Demo workspace for testing (6.58 KB, application/octet-stream)
2014-09-05 14:11 EDT, George Suaridze CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Helmut Frohner CLA 2011-12-20 08:44:36 EST
Build Identifier: M20110909-1335

I have a feature based product I want to export. In the dependencies of the features there are amongst other plugins 'org.eclipse.help.base 3.6.1.v201109091335' and 'org.eclipse.datatools.sqltools.result 1.1.1.v201101210500'.

org.eclipse.datatools.sqltools.result depends on org.apache.lucene [1.9.0,2.0.0).
org.eclipse.help.base depends on org.apache.lucene [2.9.0,3.0.0).

So I added the following dependencies to the feature depending on org.eclipse.help.base and org.eclipse.datatools.sqltools.result:
	id="org.apache.lucene.core" version="0.0.0"
	id="org.apache.lucene" version="1.9.1.v201101211617"
	id="org.apache.lucene" version="2.9.1.v201101211721"

In the target platform there are the plugins org.apache.lucene_1.9.1.v201101211617 and org.apache.lucene_2.9.1.v201101211721.
When I validate my product I get the error message: 'org.eclipse.datatools.sqltools.result: Missing Constraint: Require-Bundle: org.apache.lucene; bundle-version="[1.9.0,2.0.0)"'

org.eclipse.pde.internal.ui.editor.product.ProductValidateAction.run() ignores the versions of the features plug-in dependencies and chooses for every plug-in only the one with the highest version.

Reproducible: Always

Steps to Reproduce:
1. Create a product which depends on 'org.eclipse.help.base 3.6.1.v201109091335' and 'org.eclipse.datatools.sqltools.result 1.1.1.v201101210500'.
2. Add the needed two versions of 'org.apache.lucene' as dependencies.
3. Validate the product which fails because the smaller version of 'org.apache.lucene' is missing.
Comment 1 Stefan Weiser CLA 2013-06-13 02:40:02 EDT
The Problem in Eclipse 4.2.1 is still alive. 

The plugin org.eclipse.datatools.sqltools.result defines the maximum version 2.0.0 (exlusive) of org.apache.lucene. But the plugin provides the following version to match:
1.9.1.v201101211617
2.9.1.v201111211721
3.5.0.v20120319-2345

Isn't it possible to upgrade??
Comment 2 Pieter-Jan Pintens CLA 2014-01-10 04:42:45 EST
I have the same issue only in my case we have the problem with httpclient.

We use eclipse 4.3 as target platform. This comes with 4.1.x of httpclient.
In one of our own bundles we require some functionality of 4.3.0 of httpclient.
I added the 4.3.0 bundle (can be downloaded from their website) to our target platform and everything compiled well. I added a bundle requirement with a version.

When i try to run our application based on features from within the workspace. The validation step complains that the 4.3.0 bundle is missing even though it is in my target platform. Both bundles are also referenced in a features that is checked.

When we build our application both plugins are present and no problems are listed.
We could work around this by giving the 4.3.0 version an other bundle name but we prefer not to (if possible).
Comment 3 Al B CLA 2014-06-04 23:14:45 EDT
We are suffering from this problem as well.  the Lucene API radically changed in version 3.5. For instance, IndexReader, RAMDirectory, and others; were completely removed.

So our search code only works with Lucene 2.9.1 and migrating it to 3.5 will take some time and effort.

Updating the Run Configuration allows me to work around the problem while I'm in the IDE by selecting both versions of the lucene.core. However, this doesn't work for the *.product file so when I try to "export" the product or build it with Buckminster, then the issue re-appears because Eclipse selects the 3.5 version required by some Kepler plugins (e.g. org.eclipse.help.base). I even put explicit version numbers "2.9.1.v201101211721" for the required lucene.core plugin into my feature.xml, but it doesn't work either.

Has anyone figured out a workaround for this scenario?
Comment 4 Curtis Windatt CLA 2014-06-05 09:04:19 EDT
I will put this on the list of bugs to consider for 4.5.
Comment 5 George Suaridze CLA 2014-08-10 05:44:26 EDT
Created attachment 245854 [details]
Patch to support two or more versions of bundle with same id in feature-based product

With this patch feature-based product validation finishes without errors if there is more than one version of bundle with same id. Also product editor generates proper launch configuration now.
Comment 6 Curtis Windatt CLA 2014-08-11 11:00:47 EDT
Patch looks reasonable, but I did not test the code.
Comment 7 George Suaridze CLA 2014-08-11 11:10:22 EDT
I can attach test workspace if needed =)
Comment 8 Vikas Chandra CLA 2014-08-27 09:54:19 EDT
Can you please attach the workspace? Thanks in advance.
Comment 9 Al B CLA 2014-08-27 12:05:44 EDT
You can try with our workspace here:

https://github.com/nasa/OpenSPIFe

Once you have imported it, then switch to the SPIFe.target.  That will retrieve Lucene 2.9.1 from the Orbit side.  Then, open the SPIFe.product configuration and try to validate or launch it.  You will see that it complaints about the required 2.9.1 version because it takes the 3.5 version by default.  Even, when 2.9.1 is explicitly indicated in the feature.
Comment 10 George Suaridze CLA 2014-09-05 14:11:57 EDT
Created attachment 246785 [details]
Demo workspace for testing

I apologize for the wait. Import as existing projects from archive.

In this WS we have conflict with two versions of batik.

Luna's p2 repository has 2 versions of several boundles:

org.apache.batik.util_1.6.0.v201011041432
org.apache.batik.util_1.7.0.v201011041433

org.apache.batik.util.gui_1.6.0.v201011041432
org.apache.batik.util.gui_1.7.0.v200903091627

org.apache.batik.css_1.6.0.v201011041432
org.apache.batik.css_1.7.0.v201011041433


Bundles with 1.6.0.v201011041432 version are used by GMF 
and 1.7.0.v201011041433 used by Eclipse Platform.

Without patch applied, we have errors during validation in product editor and launch configuration is not properly generated. After applying patch everything will be alright
Comment 11 Vikas Chandra CLA 2014-09-12 09:43:32 EDT
Thanks for the workspace. This works well and other tests work fine.

Thanks George.
( I added license year changed)

Fixed in 4.5 via

http://git.eclipse.org/c/pde/eclipse.pde.ui.git/commit/?id=ef70a552e00cb07085964f7c37adf758bc48e2eb
Comment 12 Vikas Chandra CLA 2014-09-12 09:43:52 EDT
Fixed in 4.5
Comment 13 Vikas Chandra CLA 2014-09-16 08:40:47 EDT
Verified on 
Version: Mars (4.5)
Build id: I20140915-2000
on demo workspace
Comment 14 Vikas Chandra CLA 2014-09-18 09:33:24 EDT
*** Bug 443927 has been marked as a duplicate of this bug. ***
Comment 15 Louis-Frederic Huppe-St-Hilaire CLA 2015-02-27 16:17:36 EST
The patch addresses the issue for feature-based products, but what about plugin-based ones?

Even after applying the patch, our plugin-based product fails validation and export because of the batik 1.6.0/1.7.0 conflict.  We had to further modify the org.eclipse.pde.ui plugin in order to fix the issue.

Is this scenario also going to be corrected in 4.5?
Comment 16 Laurent Le Moux CLA 2016-03-08 03:10:13 EST
I confirm the problem subsists in 4.5.2...
And is also reported in bug 293048.
Comment 17 Claudia Irvine CLA 2018-09-25 08:36:33 EDT
I am having the same problem in 2018-09 (4.9)
Build id: I20180906-0745