Tycho errors building against KNIME 4.2+

Hi,

we are currently moving our builds to maven tycho. While everything works with the <= 4.1 repository, builds fail with 4.2+ and nightly with many of the following conflicts. (AFAICS) All of them revolving around your org.apache.batik.css 1.13.0.v20200617-knime plugin:

             Bundle was not resolved because of a uses constraint violation.
  org.apache.felix.resolver.reason.ReasonException: Uses constraint violation. Unable to resolve resource org.eclipse.e4.ui.css.core [osgi.identity; osgi.identity="org.eclipse.e4.ui.css.core"; type="osgi.bundle"; version:Version="0.12.1000.v20200129-0903"; singleton:="true"] because it is exposed to package 'org.w3c.dom.events' from resources org.eclipse.osgi [osgi.identity; osgi.identity="org.eclipse.osgi"; type="osgi.bundle"; version:Version="3.15.200.v20200214-1600"; singleton:="true"] and org.w3c.dom.events [osgi.identity; osgi.identity="org.w3c.dom.events"; type="osgi.bundle"; version:Version="3.0.0.draft20060413_v201105210656"] via two dependency chains.

Chain 1:
  org.eclipse.e4.ui.css.core [osgi.identity; osgi.identity="org.eclipse.e4.ui.css.core"; type="osgi.bundle"; version:Version="0.12.1000.v20200129-0903"; singleton:="true"]
    require: (&(osgi.wiring.bundle=org.eclipse.core.runtime)(&(bundle-version>=3.6.0)(!(bundle-version>=4.0.0))))
     |
    provide: osgi.wiring.bundle: org.eclipse.core.runtime
  org.eclipse.osgi [osgi.identity; osgi.identity="org.eclipse.osgi"; type="osgi.bundle"; version:Version="3.15.200.v20200214-1600"; singleton:="true"]

Chain 2:
  org.eclipse.e4.ui.css.core [osgi.identity; osgi.identity="org.eclipse.e4.ui.css.core"; type="osgi.bundle"; version:Version="0.12.1000.v20200129-0903"; singleton:="true"]
    require: (&(osgi.wiring.bundle=org.apache.batik.css)(&(bundle-version>=1.9.1)(!(bundle-version>=2.0.0))))
     |
    provide: osgi.wiring.bundle; bundle-version:Version="1.13.0.v20200617-knime"; osgi.wiring.bundle="org.apache.batik.css"
  org.apache.batik.css [osgi.identity; osgi.identity="org.apache.batik.css"; type="osgi.bundle"; version:Version="1.13.0.v20200617-knime"]
    import: (&(osgi.wiring.package=org.w3c.dom.events)(&(version>=3.0.0)(!(version>=4.0.0))))
     |
    export: osgi.wiring.package: org.w3c.dom.events
  org.w3c.dom.events [osgi.identity; osgi.identity="org.w3c.dom.events"; type="osgi.bundle"; version:Version="3.0.0.draft20060413_v201105210656"]  Unresolved requirement: Require-Bundle: org.eclipse.ui.navigator; bundle-version="[3.3.200,4.0.0)"

This only happens for our testing bundles that depend on org.knime.testing by the way. Probably due to its dependency on all that eclipse runtime, equinox stuff.
Maybe you have some ideas on how to fix it. The 3DChem nodes where I got the maven configs from, seem to still use KNIME 4.0 to do maven builds.

Best
Julianus

Hi @jpfeuffer

We had to modify the batik bundles to make them work with KNIME 4.2. I am sorry to see that this is causing you issues, I am sure we will find a way to fix this. I got two questions for you:

  1. Why are you depending on org.knime.testing in your testing bundles, do you need specific functionality from there?
  2. Are those testing bundles fragments containing unit tests? If so you might need to add a pom file with a dependency on the knime-core feature to them to ensure they are starting into the right environment, like in this example from knime-r: https://github.com/knime/knime-r/blob/e7e2d672cb654937eb5bd9aff16b1879fdaa0996/org.knime.r.tests/pom.xml

best,
Gabriel

Hey @gab1one,

thanks a lot for the super quick answer.

  1. Why are you depending on org.knime.testing in your testing bundles, do you need specific functionality from there?

Good question! I looked it up and we are using it in the following way:
import org.knime.testing.core.AbstractTestcaseCollector;

/**
 * Test case collector for config plugin.
*/
public class GKNConfigTestcaseCollector extends AbstractTestcaseCollector {
}
  1. Are those testing bundles fragments containing unit tests? If so you might need to add a pom file with a dependency on the knime-core feature to them to ensure they are starting into the right environment, like in this example from knime-r: https://github.com/knime/knime-r/blob/e7e2d672cb654937eb5bd9aff16b1879fdaa0996/org.knime.r.tests/pom.xml

TBH I think they are just simple unit tests. We also require JUnit. This part of the code is ancient. Jurassic period kind of ancient. An example is here: https://github.com/genericworkflownodes/GenericKnimeNodes/blob/develop/com.genericworkflownodes.knime.config.testing/test/com/genericworkflownodes/knime/config/writer/CTDConfigurationWriterTest.java
I need to investigate further if we have actual UI tests but I would not think so.

Hi @jpfeuffer

I had a look at your code and it seems to me that all you will need to do is to add the reference to knime core in the test plugins pom.

best,
Gabriel

That did it! Thanks a bunch.
Would you mind explaining shortly why this became necessary?

So this is necessary as tycho testing only starts an eclipse platform with the minimal nubmer of plugins installed determined by the dependencies of your plugin.
However due to platform changes in KNIME AP 4.2 we need certain fragments to prevent the classloading errors you encountered installed into the launched platform. In normal AP installations these fragments are already installed as they are contained in the org.knime.core.feature which is part of the base product.
However, this is not the case for the tycho test platform, so we need to manually add this feature as a dependency, as we can not directly define fragments as dependencies of plugins.

best,
Gabriel

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.