COVESA / capicxx-someip-tools

Common API C++ SOMEIP tooling
Mozilla Public License 2.0
76 stars 55 forks source link

Runtime error: com.google.guava dependency via two dependency chains #27

Closed badfd closed 1 year ago

badfd commented 2 years ago

Successfully built: capicxx-core-tools at tag=3.2.0.1 Successfully built: capicxx-someip-tools at tag=3.2.0.1 Then discovered that a generator, commonapi-someip-generator-linux-x86_64, fails at runtime:

$ cat org.genivi.commonapi.someip.cli.product/target/products/org.genivi.commonapi.someip.cli.product/linux/\
        gtk/x86_64/configuration/1647293754740.log
o o o
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.xtext [49] 
  Unresolved requirement: Require-Bundle: org.objectweb.asm; bundle-version="[5.0.1,6.0.0)"; \
                    resolution:="optional"
  Unresolved requirement: Require-Bundle: org.eclipse.xtext.util; visibility:="reexport"
    -> Bundle-SymbolicName: org.eclipse.xtext.util; bundle-version="2.11.0.v20170130-0808"
       org.eclipse.xtext.util [53] 
         No resolution report for the bundle.  Bundle was not resolved because of a uses constraint \
                  violation.
  org.osgi.service.resolver.ResolutionException: Uses constraint violation. Unable to resolve \
                  resource org.eclipse.xtext [osgi.identity; type="osgi.bundle"; version:\
                  Version="2.11.0.v20170130-0808"; osgi.identity="org.eclipse.xtext"; singleton:="true"] \
                  because it is exposed to package 'com.google.common.base' from resources \
                  com.google.guava [osgi.identity; type="osgi.bundle"; version:\
                  Version="18.0.0.v20161115-1643"; osgi.identity="com.google.guava"] and \
                  com.google.guava [osgi.identity; type="osgi.bundle"; version:\
                  Version="30.1.0.v20210127-2300"; osgi.identity="com.google.guava"] via two \
                  dependency chains.

Chain 1:
  org.eclipse.xtext [osgi.identity; type="osgi.bundle"; version:Version="2.11.0.v20170130-0808"; \
               osgi.identity="org.eclipse.xtext"; singleton:="true"]
    require: (osgi.wiring.bundle=org.eclipse.xtext.util)
     |    
    provide: osgi.wiring.bundle: org.eclipse.xtext.util
  com.google.guava [osgi.identity; type="osgi.bundle"; version:Version="18.0.0.v20161115-1643"; \
               osgi.identity="com.google.guava"]

Chain 2:
  org.eclipse.xtext [osgi.identity; type="osgi.bundle"; version:Version="2.11.0.v20170130-0808"; \
                   osgi.identity="org.eclipse.xtext"; singleton:="true"]
    require: (&(osgi.wiring.bundle=com.google.inject)(bundle-version>=3.0.0))
     |    
    o o o
    export: osgi.wiring.package: com.google.common.collect; uses:=com.google.common.base
    export: osgi.wiring.package=com.google.common.base
  com.google.guava [osgi.identity; type="osgi.bundle"; version:\
                   Version="30.1.0.v20210127-2300"; osgi.identity="com.google.guava"]

on Ubuntu 20.04 and:

$ mvn --version
Apache Maven 3.6.3
Maven home: /usr/share/maven
Java version: 1.8.0_312, vendor: Private Build, runtime: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.13.0-30-generic", arch: "amd64", family: "unix"
badfd commented 2 years ago

It seems that the two versions of com.google.guava are introduced by the build of capicxx-core-tools.

After deleting the ~/.m2/repository/ directory and building only capicxx-core-tools, these two versions exist:

$ cd ~/.m2
$ find . | grep com.google.guava-
./repository/p2/osgi/bundle/com.google.guava/30.1.0.v20210127-2300/com.google.guava-30.1.0.v20210127-2300.jar
./repository/p2/osgi/bundle/com.google.guava/30.1.0.v20210127-2300/com.google.guava-30.1.0.v20210127-2300-p2artifacts.xml
./repository/p2/osgi/bundle/com.google.guava/18.0.0.v20161115-1643/com.google.guava-18.0.0.v20161115-1643-p2artifacts.xml
./repository/p2/osgi/bundle/com.google.guava/18.0.0.v20161115-1643/com.google.guava-18.0.0.v20161115-1643.jar
andreias23 commented 1 year ago

Issue fixed with the PR https://github.com/COVESA/capicxx-someip-tools/pull/36

Cc: @goncaloalmeida