tycho: tycho-compiler-plugin validate-classpath fails if two plugin dependencies depend on different versions of gson themselves

I am developing an eclipse plugin that has dependencies to Eclipse TM4E and Eclipse LSP4E. TM4E released a new version some days ago which now requires gson 2.9.0 instead of 2.8.9 as before. My tycho builds which worked fine for the last year now fail with:

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:2.7.3:validate-classpath (default-validate-classpath) 
on project test.plugin: Execution default-validate-classpath of goal org.eclipse.tycho:tycho-compiler-plugin:2.7.3:validate-classpath failed:
org.osgi.framework.BundleException: Bundle test.plugin cannot be resolved:test.plugin [134]
[ERROR]   Unresolved requirement: Require-Bundle: org.eclipse.lsp4e
[ERROR]     -> Bundle-SymbolicName: org.eclipse.lsp4e; bundle-version="0.13.12.202206011407"; singleton:="true"
[ERROR]        org.eclipse.lsp4e [102]
[ERROR]          Unresolved requirement: Require-Bundle: org.eclipse.lsp4j.jsonrpc; bundle-version="[0.14.0,0.15.0)"
[ERROR]            -> Bundle-SymbolicName: org.eclipse.lsp4j.jsonrpc; bundle-version="0.14.0.v20220526-1518"
[ERROR]               org.eclipse.lsp4j.jsonrpc [106]
[ERROR]                 Unresolved requirement: Import-Package: com.google.gson; version="[2.8.9,2.9.0)"
[ERROR]          Unresolved requirement: Require-Bundle: org.eclipse.lsp4j; bundle-version="[0.14.0,0.15.0)"
[ERROR]            -> Bundle-SymbolicName: org.eclipse.lsp4j; bundle-version="0.14.0.v20220526-1518"
[ERROR]               org.eclipse.lsp4j [105]
[ERROR]                 Unresolved requirement: Import-Package: com.google.gson; version="[2.8.9,2.9.0)"

Apparently LSP4E depends on LSP4J which basically pinned it’s gson dependency version to 2.8.9. Since OSGI supports plugins depending on different versions of another plugin it should actually not an issue if LSP4E/LSP4J requires gson 2.8.9 and TM4E requires gson 2.9.0.

Interestingly trying to install TM4E and LSP4E/LSP4J manually into a barebone Eclipse Platform https://download.eclipse.org/eclipse/downloads/drops4/R-4.24-202206070700/download.php?dropFile=eclipse-platform-4.24-win32-x86_64.zip or any other Eclipse distribution works without any conflicts.

Also I can still build and directly run my plugin via a launch configuration from within Eclipse IDE, so I only experience the issue with tycho.

I created a minimal test Maven project to reproduce the issue test.zip. Just run mvn package using a Java 17 JDK and the error will appear.

If you remove the dependency to TM4E from the META-INF/MANIFEST.MF the build succeeds. Which proves that the gson 2.8.9 is resolvable/discoverable via the given platform target configuration (see the included build.target file).

Any thoughts/suggestions/explanations are highly appreciated.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 30 (24 by maintainers)

Most upvoted comments

@martinlippert This issue might be interesting for you too.