Search code examples
eclipse-rcptycho

Same plugin in two features in the same product leads to conflict because of version qualifier


I build mutiple Eclipse products using Tycho. I have a job in Jenkins per feature of my applications, plus one for utilities and one for products.

The following diagram describes my setup: dependencies

In one job ('A'), I build a plugin ('a') among others. Its version has the "qualifier" placeholder. This plugin is included in two unrelated features, each one built in a separate job ('B' and 'C'). These 2 jobs also build specific plugins. Finally, I have a job 'D' where my application is assembled using the two features.

Both features declare their dependency on the plugin with the special version "0.0.0", i.e. latest version. At compile time, each feature obtains the a.plugin and changes its qualifier. This leads to different qualifiers in each feature.

I sometimes experience the following error, leading my build to fail:

[ERROR] Cannot resolve project dependencies:
[ERROR]   Software being installed: product.d 1.0.0
[ERROR]   Only one of the following can be installed at once: [plugin.a 1.2.3.1234, plugin.a 1.2.3.5678]
[ERROR]   Cannot satisfy dependency: product.d 1.0.0 depends on: feature.b 0.0.0
[ERROR]   Cannot satisfy dependency: product.d 1.0.0 depends on: feature.c 0.0.0
[ERROR]   Cannot satisfy dependency: feature.b 1.0.0 depends on: plugin.a [1.2.3.1234]
[ERROR]   Cannot satisfy dependency: feature.c 1.0.0 depends on: plugin.a [1.2.3.5678]

Thus plugin.a being compiled only once, do you know what I could do to have my product resolve this false conflict?


Solution

  • A feature build doesn't change the qualifier of the plug-ins; it uses the plug-in which is available in the target platform without modification. The feature build only modifies files which go into the feature JAR, e.g. it replaces the version in reference to plug-ins with the available version in the feature.xml.

    So in case of the described failure in the build of job D, your feature build jobs have seen different versions of plugin.a. This e.g. happens when your jobs build in this order: A (builds plugin.a_1.2.3.1234) - B - A (builds plugin.a_1.2.3.5678) - C - D. When this happens, there is no way that the build of the product (job D) can succeed.

    But really the question you should be asking yourself is if you really need this complicated setup. A feature build is close to a NOP in Tycho, so you could just always build your features together with the plug-in(s) in job A.

    There are potential ways to even make the complex job setup work reliably, e.g. by replacing the plug-in inclusion in one of the features by a plug-in reference, or by using SCM-based reproducible build qualifiers (very advanced!). But all these options don't seem to be worth the effort in your case.