saturnism / grpc-by-example-java

A collection of useful/essential gRPC Java Examples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

“NoSuchMethodErrors” due to multiple versions of com.google.protobuf:protobuf-java:jar

Bing-ok opened this issue · comments

Hi, there are multiple versions of com.google.protobuf:protobuf-java in grpc-by-example-java-master\springboot-example-lognet. As shown in the following dependency tree, according to Maven's “nearest wins” strategy, only com.google.protobuf:protobuf-java:3.6.1 can be loaded, com.google.protobuf:protobuf-java:3.5.1 and com.google.protobuf:protobuf-java:3.7.1 will be shadowed.

As com.google.protobuf:protobuf-java:3.7.1 has not been loaded during the building process, several methods are missing. However, the missing methods:
1. com.google.protobuf.GeneratedMessageV3: com.google.protobuf.Internal$LongList mutableCopy(com.google.protobuf.Internal$LongList)

Check for details of invocation

paths------
<com.example.demo.GreetingRequest$Builder: com.example.demo.GreetingRequest$Builder clone()> grpc-by-example-java-master\springboot-example-lognet\target\classes
<com.google.protobuf.GeneratedMessageV3$Builder: com.google.protobuf.GeneratedMessageV3$Builder clone()> Repositories\com\google\protobuf\protobuf-java\3.6.1\protobuf-java-3.6.1.jar
<com.google.api.Distribution$Builder: com.google.protobuf.AbstractMessage$Builder mergeFrom(com.google.protobuf.Message)> Repositories\com\google\api\grpc\proto-google-common-protos\1.16.0\proto-google-common-protos-1.16.0.jar
<com.google.api.Distribution$Builder: com.google.api.Distribution$Builder mergeFrom(com.google.protobuf.Message)> Repositories\com\google\api\grpc\proto-google-common-protos\1.16.0\proto-google-common-protos-1.16.0.jar
<com.google.api.Distribution$Builder: com.google.api.Distribution$Builder mergeFrom(com.google.api.Distribution)> Repositories\com\google\api\grpc\proto-google-common-protos\1.16.0\proto-google-common-protos-1.16.0.jar
<com.google.api.Distribution$Builder: void ensureBucketCountsIsMutable()> Repositories\com\google\api\grpc\proto-google-common-protos\1.16.0\proto-google-common-protos-1.16.0.jar
<com.google.api.Distribution: com.google.protobuf.Internal$LongList access$7900(com.google.protobuf.Internal$LongList)> Repositories\com\google\api\grpc\proto-google-common-protos\1.16.0\proto-google-common-protos-1.16.0.jar
<com.google.protobuf.GeneratedMessageV3: com.google.protobuf.Internal$LongList mutableCopy(com.google.protobuf.Internal$LongList)>

2. com.google.protobuf.GeneratedMessageV3: com.google.protobuf.Internal$LongList emptyLongList()

Check for details of invocation

paths------
<com.example.demo.WhoRequest$Builder: com.example.demo.WhoRequest$Builder mergeFrom(com.google.protobuf.CodedInputStream,com.google.protobuf.ExtensionRegistryLite)> grpc-by-example-java-master\springboot-example-lognet\target\classes
<com.google.api.Distribution$1: java.lang.Object parsePartialFrom(com.google.protobuf.CodedInputStream,com.google.protobuf.ExtensionRegistryLite)> Repositories\com\google\api\grpc\proto-google-common-protos\1.16.0\proto-google-common-protos-1.16.0.jar
<com.google.api.Distribution$1: com.google.api.Distribution parsePartialFrom(com.google.protobuf.CodedInputStream,com.google.protobuf.ExtensionRegistryLite)> Repositories\com\google\api\grpc\proto-google-common-protos\1.16.0\proto-google-common-protos-1.16.0.jar
<com.google.api.Distribution: void clinit()> com\google\api\grpc\proto-google-common-protos\1.16.0\proto-google-common-protos-1.16.0.jar
<com.google.api.Distribution: void init()> Repositories\com\google\api\grpc\proto-google-common-protos\1.16.0\proto-google-common-protos-1.16.0.jar
<com.google.protobuf.GeneratedMessageV3: com.google.protobuf.Internal$LongList emptyLongList()>

3. com.google.protobuf.GeneratedMessageV3: com.google.protobuf.Internal$DoubleList mutableCopy(com.google.protobuf.Internal$DoubleList)

Check for details of invocation

paths------
<com.example.demo.GreetingRequest$Builder: com.example.demo.GreetingRequest$Builder clone()> grpc-by-example-java-master\springboot-example-lognet\target\classes
<com.google.protobuf.GeneratedMessageV3$Builder: com.google.protobuf.GeneratedMessageV3$Builder clone()> Repositories\com\google\protobuf\protobuf-java\3.6.1\protobuf-java-3.6.1.jar
<com.google.api.Distribution$BucketOptions$Explicit$Builder: com.google.protobuf.AbstractMessage$Builder mergeFrom(com.google.protobuf.Message)> Repositories\com\google\api\grpc\proto-google-common-protos\1.16.0\proto-google-common-protos-1.16.0.jar
<com.google.api.Distribution$BucketOptions$Explicit$Builder: com.google.api.Distribution$BucketOptions$Explicit$Builder mergeFrom(com.google.protobuf.Message)> Repositories\com\google\api\grpc\proto-google-common-protos\1.16.0\proto-google-common-protos-1.16.0.jar
<com.google.api.Distribution$BucketOptions$Explicit$Builder: com.google.api.Distribution$BucketOptions$Explicit$Builder mergeFrom(com.google.api.Distribution$BucketOptions$Explicit)> Repositories\com\google\api\grpc\proto-google-common-protos\1.16.0\proto-google-common-protos-1.16.0.jar
<com.google.api.Distribution$BucketOptions$Explicit$Builder: void ensureBoundsIsMutable()> Repositories\com\google\api\grpc\proto-google-common-protos\1.16.0\proto-google-common-protos-1.16.0.jar
<com.google.api.Distribution$BucketOptions$Explicit: com.google.protobuf.Internal$DoubleList access$3800(com.google.protobuf.Internal$DoubleList)> Repositories\com\google\api\grpc\proto-google-common-protos\1.16.0\proto-google-common-protos-1.16.0.jar
<com.google.protobuf.GeneratedMessageV3: com.google.protobuf.Internal$DoubleList mutableCopy(com.google.protobuf.Internal$DoubleList)>

4. com.google.protobuf.GeneratedMessageV3: com.google.protobuf.Internal$DoubleList emptyDoubleList()

Check for details of invocation

paths------
<com.example.demo.WhoRequest$Builder: com.example.demo.WhoRequest$Builder mergeFrom(com.google.protobuf.CodedInputStream,com.google.protobuf.ExtensionRegistryLite)> grpc-by-example-java-master\springboot-example-lognet\target\classes
<com.google.api.Distribution$BucketOptions$Explicit$1: java.lang.Object parsePartialFrom(com.google.protobuf.CodedInputStream,com.google.protobuf.ExtensionRegistryLite)> Repositories\com\google\api\grpc\proto-google-common-protos\1.16.0\proto-google-common-protos-1.16.0.jar
<com.google.api.Distribution$BucketOptions$Explicit$1: com.google.api.Distribution$BucketOptions$Explicit parsePartialFrom(com.google.protobuf.CodedInputStream,com.google.protobuf.ExtensionRegistryLite)> Repositories\com\google\api\grpc\proto-google-common-protos\1.16.0\proto-google-common-protos-1.16.0.jar
<com.google.api.Distribution$BucketOptions$Explicit: void clinit()> Repositories\com\google\api\grpc\proto-google-common-protos\1.16.0\proto-google-common-protos-1.16.0.jar
<com.google.api.Distribution$BucketOptions$Explicit: void init()> Repositories\com\google\api\grpc\proto-google-common-protos\1.16.0\proto-google-common-protos-1.16.0.jar
<com.google.protobuf.GeneratedMessageV3: com.google.protobuf.Internal$DoubleList emptyDoubleList()>

5. com.google.protobuf.GeneratedMessageV3: com.google.protobuf.Internal$DoubleList newDoubleList()

Check for details of invocation

paths------
<com.example.demo.WhoRequest$Builder: com.example.demo.WhoRequest$Builder mergeFrom(com.google.protobuf.CodedInputStream,com.google.protobuf.ExtensionRegistryLite)> grpc-by-example-java-master\springboot-example-lognet\target\classes
<com.google.api.Distribution$BucketOptions$Explicit$1: java.lang.Object parsePartialFrom(com.google.protobuf.CodedInputStream,com.google.protobuf.ExtensionRegistryLite)> Repositories\com\google\api\grpc\proto-google-common-protos\1.16.0\proto-google-common-protos-1.16.0.jar
<com.google.api.Distribution$BucketOptions$Explicit$1: com.google.api.Distribution$BucketOptions$Explicit parsePartialFrom(com.google.protobuf.CodedInputStream,com.google.protobuf.ExtensionRegistryLite)> Repositories\com\google\api\grpc\proto-google-common-protos\1.16.0\proto-google-common-protos-1.16.0.jar
<com.google.api.Distribution$BucketOptions$Explicit: void init(com.google.protobuf.CodedInputStream,com.google.protobuf.ExtensionRegistryLite,com.google.api.Distribution$1)> Repositories\com\google\api\grpc\proto-google-common-protos\1.16.0\proto-google-common-protos-1.16.0.jar
<com.google.api.Distribution$BucketOptions$Explicit: void init(com.google.protobuf.CodedInputStream,com.google.protobuf.ExtensionRegistryLite)> Repositories\com\google\api\grpc\proto-google-common-protos\1.16.0\proto-google-common-protos-1.16.0.jar
<com.google.protobuf.GeneratedMessageV3: com.google.protobuf.Internal$DoubleList newDoubleList()>

6. com.google.protobuf.GeneratedMessageV3: com.google.protobuf.Internal$LongList newLongList()

Check for details of invocation

paths------
<com.example.demo.GreetingResponse$Builder: com.example.demo.GreetingResponse$Builder mergeFrom(com.google.protobuf.CodedInputStream,com.google.protobuf.ExtensionRegistryLite)> grpc-by-example-java-master\springboot-example-lognet\target\classes
<com.google.api.Distribution$1: java.lang.Object parsePartialFrom(com.google.protobuf.CodedInputStream,com.google.protobuf.ExtensionRegistryLite)> Repositories\com\google\api\grpc\proto-google-common-protos\1.16.0\proto-google-common-protos-1.16.0.jar
<com.google.api.Distribution$1: com.google.api.Distribution parsePartialFrom(com.google.protobuf.CodedInputStream,com.google.protobuf.ExtensionRegistryLite)> Repositories\com\google\api\grpc\proto-google-common-protos\1.16.0\proto-google-common-protos-1.16.0.jar
<com.google.api.Distribution: void (com.google.protobuf.CodedInputStream,com.google.protobuf.ExtensionRegistryLite,com.google.api.Distribution$1)> Repositories\com\google\api\grpc\proto-google-common-protos\1.16.0\proto-google-common-protos-1.16.0.jar
<com.google.api.Distribution: void (com.google.protobuf.CodedInputStream,com.google.protobuf.ExtensionRegistryLite)> Repositories\com\google\api\grpc\proto-google-common-protos\1.16.0\proto-google-common-protos-1.16.0.jar
<com.google.protobuf.GeneratedMessageV3: com.google.protobuf.Internal$LongList newLongList()>

The above missing methods are actually referenced by grpc-by-example-java-master\springboot-example-lognet, which will cause “NoSuchMethodErrors” at runtime.

Suggested fixing solutions:

  1. Use configuration attribute <dependencyManagement> to unify the version of library com.google.protobuf:protobuf-java to be 3.7.1 in grpc-by-example-java-master\springboot-example-lognet's pom file.
  2. Upgrade dependency com.google.protobuf:protobuf-java from 3.6.1 to 3.7.1

Please let me know which solution do you prefer? I can submit a PR to fix it.

Thank you very much for your attention.
Best regards,

Dependency tree----

click for details

[INFO] com.example:springboot-example-lognet:jar:0.0.1-SNAPSHOT
[INFO] +- com.google.guava:guava:jar:27.1-jre:compile
[INFO] |  +- com.google.guava:failureaccess:jar:1.0.1:compile
[INFO] |  +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile
[INFO] |  +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] |  +- org.checkerframework:checker-qual:jar:2.5.2:compile
[INFO] |  +- com.google.errorprone:error_prone_annotations:jar:2.2.0:compile
[INFO] |  +- com.google.j2objc:j2objc-annotations:jar:1.1:compile
[INFO] |  \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.17:compile
[INFO] +- org.springframework.cloud:spring-cloud-gcp-starter:jar:1.1.2.RELEASE:compile
[INFO] |  +- org.springframework.cloud:spring-cloud-gcp-core:jar:1.1.2.RELEASE:compile
[INFO] |  |  +- com.google.cloud:google-cloud-core:jar:1.78.0:compile
[INFO] |  |  |  +- (com.google.guava:guava:jar:27.1-android:compile - omitted for conflict with 27.1-jre)
[INFO] |  |  |  +- com.google.http-client:google-http-client:jar:1.30.1:compile
[INFO] |  |  |  |  +- org.apache.httpcomponents:httpclient:jar:4.5.9:compile (version managed from 4.5.8)
[INFO] |  |  |  |  |  +- org.apache.httpcomponents:httpcore:jar:4.4.11:compile
[INFO] |  |  |  |  |  \- commons-codec:commons-codec:jar:1.11:compile
[INFO] |  |  |  |  +- (com.google.guava:guava:jar:26.0-android:compile - omitted for conflict with 27.1-jre)
[INFO] |  |  |  |  +- (com.google.j2objc:j2objc-annotations:jar:1.3:compile - omitted for conflict with 1.1)
[INFO] |  |  |  |  +- (io.opencensus:opencensus-api:jar:0.21.0:compile - omitted for conflict with 0.19.2)
[INFO] |  |  |  |  \- io.opencensus:opencensus-contrib-http-util:jar:0.21.0:compile
[INFO] |  |  |  |     +- (io.opencensus:opencensus-api:jar:0.21.0:compile - omitted for duplicate)
[INFO] |  |  |  |     \- (com.google.guava:guava:jar:26.0-android:compile - omitted for conflict with 27.1-jre)
[INFO] |  |  |  +- (com.google.code.findbugs:jsr305:jar:3.0.2:compile - omitted for duplicate)
[INFO] |  |  |  +- com.google.api:api-common:jar:1.8.1:compile
[INFO] |  |  |  |  +- (com.google.code.findbugs:jsr305:jar:3.0.2:compile - omitted for duplicate)
[INFO] |  |  |  |  +- (com.google.guava:guava:jar:26.0-android:compile - omitted for conflict with 27.1-jre)
[INFO] |  |  |  |  \- (javax.annotation:javax.annotation-api:jar:1.3.2:compile - omitted for duplicate)
[INFO] |  |  |  +- com.google.api:gax:jar:1.45.0:compile
[INFO] |  |  |  |  +- (com.google.guava:guava:jar:26.0-android:compile - omitted for conflict with 27.1-jre)
[INFO] |  |  |  |  +- (com.google.code.findbugs:jsr305:jar:3.0.2:compile - omitted for duplicate)
[INFO] |  |  |  |  +- org.threeten:threetenbp:jar:1.3.3:compile
[INFO] |  |  |  |  +- com.google.auth:google-auth-library-oauth2-http:jar:0.16.1:compile (version managed from 0.15.0)
[INFO] |  |  |  |  |  +- com.google.auth:google-auth-library-credentials:jar:0.16.1:compile
[INFO] |  |  |  |  |  +- (com.google.http-client:google-http-client:jar:1.30.1:compile - omitted for duplicate)
[INFO] |  |  |  |  |  \- com.google.http-client:google-http-client-jackson2:jar:1.30.1:compile
[INFO] |  |  |  |  |     +- (com.google.http-client:google-http-client:jar:1.30.1:compile - omitted for duplicate)
[INFO] |  |  |  |  |     \- (com.fasterxml.jackson.core:jackson-core:jar:2.9.9:compile - omitted for duplicate)
[INFO] |  |  |  |  +- (com.google.api:api-common:jar:1.8.1:compile - version managed from 1.7.0; omitted for duplicate)
[INFO] |  |  |  |  \- (io.opencensus:opencensus-api:jar:0.21.0:compile - omitted for duplicate)
[INFO] |  |  |  +- (com.google.protobuf:protobuf-java-util:jar:3.7.1:compile - omitted for conflict with 3.6.1)
[INFO] |  |  |  +- com.google.api.grpc:proto-google-common-protos:jar:1.16.0:compile
[INFO] |  |  |  |  \- (com.google.protobuf:protobuf-java:jar:3.7.1:compile - omitted for duplicate)
[INFO] |  |  |  +- com.google.api.grpc:proto-google-iam-v1:jar:0.12.0:compile
[INFO] |  |  |  |  +- (com.google.protobuf:protobuf-java:jar:3.5.1:compile - omitted for conflict with 3.7.1)
[INFO] |  |  |  |  +- (com.google.api:api-common:jar:1.8.1:compile - version managed from 1.5.0; omitted for duplicate)
[INFO] |  |  |  |  \- (com.google.api.grpc:proto-google-common-protos:jar:1.16.0:compile - version managed from 1.11.0; omitted for duplicate)
[INFO] |  |  |  \- (javax.annotation:javax.annotation-api:jar:1.3.2:compile - omitted for duplicate)
[INFO] |  |  +- org.springframework:spring-core:jar:5.1.9.RELEASE:compile (version managed from 5.1.8.RELEASE)
[INFO] |  |  |  \- org.springframework:spring-jcl:jar:5.1.9.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-context:jar:5.1.9.RELEASE:compile (version managed from 5.1.8.RELEASE)
[INFO] |  |  |  +- org.springframework:spring-aop:jar:5.1.9.RELEASE:compile
[INFO] |  |  |  |  +- (org.springframework:spring-beans:jar:5.1.9.RELEASE:compile - omitted for duplicate)
[INFO] |  |  |  |  \- (org.springframework:spring-core:jar:5.1.9.RELEASE:compile - version managed from 5.1.8.RELEASE; omitted for duplicate)
[INFO] |  |  |  +- (org.springframework:spring-beans:jar:5.1.9.RELEASE:compile - omitted for duplicate)
[INFO] |  |  |  +- (org.springframework:spring-core:jar:5.1.9.RELEASE:compile - version managed from 5.1.8.RELEASE; omitted for duplicate)
[INFO] |  |  |  \- org.springframework:spring-expression:jar:5.1.9.RELEASE:compile
[INFO] |  |  |     \- (org.springframework:spring-core:jar:5.1.9.RELEASE:compile - version managed from 5.1.8.RELEASE; omitted for duplicate)
[INFO] |  |  \- (org.slf4j:slf4j-api:jar:1.7.26:compile - version managed from 1.7.25; omitted for duplicate)
[INFO] |  +- org.springframework.cloud:spring-cloud-gcp-autoconfigure:jar:1.1.2.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:2.1.7.RELEASE:compile (version managed from 2.1.6.RELEASE)
[INFO] |  |  |  \- (org.springframework.boot:spring-boot:jar:2.1.7.RELEASE:compile - omitted for duplicate)
[INFO] |  |  +- (org.springframework.cloud:spring-cloud-gcp-core:jar:1.1.2.RELEASE:compile - omitted for duplicate)
[INFO] |  |  \- (org.slf4j:slf4j-api:jar:1.7.26:compile - omitted for duplicate)
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:2.1.7.RELEASE:compile (version managed from 2.1.6.RELEASE)
[INFO] |  |  +- org.springframework.boot:spring-boot:jar:2.1.7.RELEASE:compile
[INFO] |  |  |  +- (org.springframework:spring-core:jar:5.1.9.RELEASE:compile - version managed from 5.1.8.RELEASE; omitted for duplicate)
[INFO] |  |  |  \- (org.springframework:spring-context:jar:5.1.9.RELEASE:compile - version managed from 5.1.8.RELEASE; omitted for duplicate)
[INFO] |  |  +- (org.springframework.boot:spring-boot-autoconfigure:jar:2.1.7.RELEASE:compile - version managed from 2.1.6.RELEASE; omitted for duplicate)
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:2.1.7.RELEASE:compile
[INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] |  |  |  |  +- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] |  |  |  |  \- (org.slf4j:slf4j-api:jar:1.7.26:compile - version managed from 1.7.25; omitted for duplicate)
[INFO] |  |  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.11.2:compile
[INFO] |  |  |  |  +- (org.slf4j:slf4j-api:jar:1.7.26:compile - version managed from 1.7.25; omitted for duplicate)
[INFO] |  |  |  |  \- org.apache.logging.log4j:log4j-api:jar:2.11.2:compile
[INFO] |  |  |  \- org.slf4j:jul-to-slf4j:jar:1.7.26:compile
[INFO] |  |  |     \- (org.slf4j:slf4j-api:jar:1.7.26:compile - version managed from 1.7.25; omitted for duplicate)
[INFO] |  |  +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] |  |  +- (org.springframework:spring-core:jar:5.1.9.RELEASE:compile - version managed from 5.1.8.RELEASE; omitted for duplicate)
[INFO] |  |  \- org.yaml:snakeyaml:jar:1.23:runtime
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.26:compile
[INFO] +- io.github.lognet:grpc-spring-boot-starter:jar:3.2.0:compile
[INFO] |  +- io.grpc:grpc-netty:jar:1.19.0:compile
[INFO] |  |  +- io.grpc:grpc-core:jar:1.19.0:compile
[INFO] |  |  |  +- io.grpc:grpc-context:jar:1.19.0:compile
[INFO] |  |  |  +- com.google.code.gson:gson:jar:2.8.5:compile
[INFO] |  |  |  +- (com.google.errorprone:error_prone_annotations:jar:2.2.0:compile - omitted for duplicate)
[INFO] |  |  |  +- (com.google.code.findbugs:jsr305:jar:3.0.2:compile - omitted for duplicate)
[INFO] |  |  |  +- (org.codehaus.mojo:animal-sniffer-annotations:jar:1.17:compile - omitted for duplicate)
[INFO] |  |  |  +- (com.google.guava:guava:jar:26.0-android:compile - omitted for conflict with 27.1-jre)
[INFO] |  |  |  +- io.opencensus:opencensus-api:jar:0.19.2:compile
[INFO] |  |  |  \- io.opencensus:opencensus-contrib-grpc-metrics:jar:0.19.2:compile
[INFO] |  |  |     \- (io.opencensus:opencensus-api:jar:0.19.2:compile - omitted for duplicate)
[INFO] |  |  +- io.netty:netty-codec-http2:jar:4.1.38.Final:compile
[INFO] |  |  |  +- io.netty:netty-common:jar:4.1.38.Final:compile
[INFO] |  |  |  +- io.netty:netty-buffer:jar:4.1.38.Final:compile
[INFO] |  |  |  |  \- (io.netty:netty-common:jar:4.1.38.Final:compile - omitted for duplicate)
[INFO] |  |  |  +- io.netty:netty-transport:jar:4.1.38.Final:compile
[INFO] |  |  |  |  +- (io.netty:netty-common:jar:4.1.38.Final:compile - omitted for duplicate)
[INFO] |  |  |  |  +- (io.netty:netty-buffer:jar:4.1.38.Final:compile - omitted for duplicate)
[INFO] |  |  |  |  \- io.netty:netty-resolver:jar:4.1.38.Final:compile
[INFO] |  |  |  |     \- (io.netty:netty-common:jar:4.1.38.Final:compile - omitted for duplicate)
[INFO] |  |  |  +- io.netty:netty-codec:jar:4.1.38.Final:compile
[INFO] |  |  |  |  +- (io.netty:netty-common:jar:4.1.38.Final:compile - omitted for duplicate)
[INFO] |  |  |  |  +- (io.netty:netty-buffer:jar:4.1.38.Final:compile - omitted for duplicate)
[INFO] |  |  |  |  \- (io.netty:netty-transport:jar:4.1.38.Final:compile - omitted for duplicate)
[INFO] |  |  |  +- io.netty:netty-handler:jar:4.1.38.Final:compile
[INFO] |  |  |  |  +- (io.netty:netty-common:jar:4.1.38.Final:compile - omitted for duplicate)
[INFO] |  |  |  |  +- (io.netty:netty-buffer:jar:4.1.38.Final:compile - omitted for duplicate)
[INFO] |  |  |  |  +- (io.netty:netty-transport:jar:4.1.38.Final:compile - omitted for duplicate)
[INFO] |  |  |  |  \- (io.netty:netty-codec:jar:4.1.38.Final:compile - omitted for duplicate)
[INFO] |  |  |  \- io.netty:netty-codec-http:jar:4.1.38.Final:compile
[INFO] |  |  |     +- (io.netty:netty-common:jar:4.1.38.Final:compile - omitted for duplicate)
[INFO] |  |  |     +- (io.netty:netty-buffer:jar:4.1.38.Final:compile - omitted for duplicate)
[INFO] |  |  |     +- (io.netty:netty-transport:jar:4.1.38.Final:compile - omitted for duplicate)
[INFO] |  |  |     +- (io.netty:netty-codec:jar:4.1.38.Final:compile - omitted for duplicate)
[INFO] |  |  |     \- (io.netty:netty-handler:jar:4.1.38.Final:compile - omitted for duplicate)
[INFO] |  |  \- io.netty:netty-handler-proxy:jar:4.1.38.Final:compile (version managed from 4.1.32.Final)
[INFO] |  |     +- (io.netty:netty-common:jar:4.1.38.Final:compile - omitted for duplicate)
[INFO] |  |     +- (io.netty:netty-buffer:jar:4.1.38.Final:compile - omitted for duplicate)
[INFO] |  |     +- (io.netty:netty-transport:jar:4.1.38.Final:compile - omitted for duplicate)
[INFO] |  |     +- (io.netty:netty-codec:jar:4.1.38.Final:compile - omitted for duplicate)
[INFO] |  |     +- io.netty:netty-codec-socks:jar:4.1.38.Final:compile
[INFO] |  |     |  +- (io.netty:netty-common:jar:4.1.38.Final:compile - omitted for duplicate)
[INFO] |  |     |  +- (io.netty:netty-buffer:jar:4.1.38.Final:compile - omitted for duplicate)
[INFO] |  |     |  +- (io.netty:netty-transport:jar:4.1.38.Final:compile - omitted for duplicate)
[INFO] |  |     |  \- (io.netty:netty-codec:jar:4.1.38.Final:compile - omitted for duplicate)
[INFO] |  |     \- (io.netty:netty-codec-http:jar:4.1.38.Final:compile - omitted for duplicate)
[INFO] |  +- io.grpc:grpc-services:jar:1.19.0:compile
[INFO] |  |  +- io.grpc:grpc-protobuf:jar:1.19.0:compile
[INFO] |  |  |  +- (io.grpc:grpc-core:jar:1.19.0:compile - omitted for duplicate)
[INFO] |  |  |  +- com.google.protobuf:protobuf-java:jar:3.6.1:compile
[INFO] |  |  |  +- (com.google.guava:guava:jar:26.0-android:compile - omitted for conflict with 27.1-jre)
[INFO] |  |  |  +- (com.google.api.grpc:proto-google-common-protos:jar:1.16.0:compile - version managed from 1.12.0; omitted for duplicate)
[INFO] |  |  |  \- io.grpc:grpc-protobuf-lite:jar:1.19.0:compile
[INFO] |  |  |     +- (io.grpc:grpc-core:jar:1.19.0:compile - omitted for duplicate)
[INFO] |  |  |     \- (com.google.guava:guava:jar:26.0-android:compile - omitted for conflict with 27.1-jre)
[INFO] |  |  +- io.grpc:grpc-stub:jar:1.19.0:compile
[INFO] |  |  |  \- (io.grpc:grpc-core:jar:1.19.0:compile - omitted for duplicate)
[INFO] |  |  +- com.google.protobuf:protobuf-java-util:jar:3.6.1:compile
[INFO] |  |  |  +- (com.google.protobuf:protobuf-java:jar:3.6.1:compile - omitted for duplicate)
[INFO] |  |  |  \- (com.google.code.gson:gson:jar:2.8.5:compile - version managed from 2.7; omitted for duplicate)
[INFO] |  |  \- com.google.re2j:re2j:jar:1.2:compile
[INFO] |  \- (org.springframework.boot:spring-boot-starter:jar:2.1.7.RELEASE:compile - version managed from 1.5.13.RELEASE; omitted for duplicate)
[INFO] +- org.springframework.boot:spring-boot-starter-activemq:jar:2.1.7.RELEASE:compile
[INFO] |  +- (org.springframework.boot:spring-boot-starter:jar:2.1.7.RELEASE:compile - version managed from 1.5.13.RELEASE; omitted for duplicate)
[INFO] |  +- org.springframework:spring-jms:jar:5.1.9.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-beans:jar:5.1.9.RELEASE:compile
[INFO] |  |  |  \- (org.springframework:spring-core:jar:5.1.9.RELEASE:compile - version managed from 5.1.8.RELEASE; omitted for duplicate)
[INFO] |  |  +- (org.springframework:spring-core:jar:5.1.9.RELEASE:compile - version managed from 5.1.8.RELEASE; omitted for duplicate)
[INFO] |  |  +- org.springframework:spring-messaging:jar:5.1.9.RELEASE:compile
[INFO] |  |  |  +- (org.springframework:spring-beans:jar:5.1.9.RELEASE:compile - omitted for duplicate)
[INFO] |  |  |  \- (org.springframework:spring-core:jar:5.1.9.RELEASE:compile - version managed from 5.1.8.RELEASE; omitted for duplicate)
[INFO] |  |  \- org.springframework:spring-tx:jar:5.1.9.RELEASE:compile
[INFO] |  |     +- (org.springframework:spring-beans:jar:5.1.9.RELEASE:compile - omitted for duplicate)
[INFO] |  |     \- (org.springframework:spring-core:jar:5.1.9.RELEASE:compile - version managed from 5.1.8.RELEASE; omitted for duplicate)
[INFO] |  +- org.apache.activemq:activemq-broker:jar:5.15.9:compile
[INFO] |  |  +- org.apache.activemq:activemq-client:jar:5.15.9:compile
[INFO] |  |  |  +- (org.slf4j:slf4j-api:jar:1.7.26:compile - version managed from 1.7.25; omitted for duplicate)
[INFO] |  |  |  +- org.fusesource.hawtbuf:hawtbuf:jar:1.11:compile
[INFO] |  |  |  \- org.apache.geronimo.specs:geronimo-j2ee-management_1.1_spec:jar:1.0.1:compile
[INFO] |  |  +- org.apache.activemq:activemq-openwire-legacy:jar:5.15.9:compile
[INFO] |  |  |  \- (org.apache.activemq:activemq-client:jar:5.15.9:compile - omitted for duplicate)
[INFO] |  |  +- (com.google.guava:guava:jar:18.0:compile - omitted for conflict with 27.1-jre)
[INFO] |  |  \- com.fasterxml.jackson.core:jackson-databind:jar:2.9.9:compile (version managed from 2.9.8)
[INFO] |  |     +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
[INFO] |  |     \- com.fasterxml.jackson.core:jackson-core:jar:2.9.9:compile
[INFO] |  \- javax.jms:javax.jms-api:jar:2.0.1:compile
[INFO] +- org.springframework.boot:spring-boot-starter-jdbc:jar:2.1.7.RELEASE:compile
[INFO] |  +- (org.springframework.boot:spring-boot-starter:jar:2.1.7.RELEASE:compile - version managed from 1.5.13.RELEASE; omitted for duplicate)
[INFO] |  +- com.zaxxer:HikariCP:jar:3.2.0:compile
[INFO] |  |  \- (org.slf4j:slf4j-api:jar:1.7.26:compile - version managed from 1.7.25; omitted for duplicate)
[INFO] |  \- org.springframework:spring-jdbc:jar:5.1.9.RELEASE:compile
[INFO] |     +- (org.springframework:spring-beans:jar:5.1.9.RELEASE:compile - omitted for duplicate)
[INFO] |     +- (org.springframework:spring-core:jar:5.1.9.RELEASE:compile - version managed from 5.1.8.RELEASE; omitted for duplicate)
[INFO] |     \- (org.springframework:spring-tx:jar:5.1.9.RELEASE:compile - omitted for duplicate)
[INFO] +- org.hsqldb:hsqldb:jar:2.4.1:runtime
[INFO] \- org.springframework.boot:spring-boot-starter-test:jar:2.1.7.RELEASE:test
[INFO]    +- (org.springframework.boot:spring-boot-starter:jar:2.1.7.RELEASE:test - version managed from 1.5.13.RELEASE; omitted for duplicate)
[INFO]    +- org.springframework.boot:spring-boot-test:jar:2.1.7.RELEASE:test
[INFO]    |  \- (org.springframework.boot:spring-boot:jar:2.1.7.RELEASE:test - omitted for duplicate)
[INFO]    +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.1.7.RELEASE:test
[INFO]    |  +- (org.springframework.boot:spring-boot-test:jar:2.1.7.RELEASE:test - omitted for duplicate)
[INFO]    |  \- (org.springframework.boot:spring-boot-autoconfigure:jar:2.1.7.RELEASE:test - version managed from 2.1.6.RELEASE; omitted for duplicate)
[INFO]    +- com.jayway.jsonpath:json-path:jar:2.4.0:test
[INFO]    |  +- net.minidev:json-smart:jar:2.3:test
[INFO]    |  |  \- net.minidev:accessors-smart:jar:1.2:test
[INFO]    |  |     \- org.ow2.asm:asm:jar:5.0.4:test
[INFO]    |  \- (org.slf4j:slf4j-api:jar:1.7.26:test - version managed from 1.7.25; omitted for duplicate)
[INFO]    +- junit:junit:jar:4.12:test
[INFO]    |  \- (org.hamcrest:hamcrest-core:jar:1.3:test - omitted for duplicate)
[INFO]    +- org.assertj:assertj-core:jar:3.11.1:test
[INFO]    +- org.mockito:mockito-core:jar:2.23.4:test
[INFO]    |  +- net.bytebuddy:byte-buddy:jar:1.9.16:test (version managed from 1.9.3)
[INFO]    |  +- net.bytebuddy:byte-buddy-agent:jar:1.9.16:test (version managed from 1.9.3)
[INFO]    |  \- org.objenesis:objenesis:jar:2.6:test
[INFO]    +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO]    +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO]    |  \- (org.hamcrest:hamcrest-core:jar:1.3:test - omitted for duplicate)
[INFO]    +- org.skyscreamer:jsonassert:jar:1.5.0:test
[INFO]    |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO]    +- (org.springframework:spring-core:jar:5.1.9.RELEASE:compile - version managed from 5.1.8.RELEASE; scope updated from test; omitted for duplicate)
[INFO]    +- org.springframework:spring-test:jar:5.1.9.RELEASE:test
[INFO]    |  \- (org.springframework:spring-core:jar:5.1.9.RELEASE:test - version managed from 5.1.8.RELEASE; omitted for duplicate)
[INFO]    \- org.xmlunit:xmlunit-core:jar:2.6.3:test

Could you help me review this issue? 👍 Thanks! @saturnism

hi @Bing-ok ! apologies for the late reply. is this in your project, or my sample here? could i trouble you to provide some instructions to reproduce this? thanks!

Hi @saturnism ! I found this issue in your example by analyzing depedencies and code. I had given details of invocation paths.

@Bing-ok i see the issue! Thanks for the dep tree. I think we can remove the dependency on spring cloud gcp since we aren't using this at all.

i pushed the changes, pls take a look! thanks!

@saturnism Thanks for your support! I have seen the changes. By the way, if you didn't remove the dependency on spring cloud gcp, which one of the solutions I proposed above would you choose?

@Bing-ok if the highest version works, I would:

  1. Use Maven enforcer's requireUpperBound rule to make sure it's using the higher of the version
  2. Import Protobuf BOM in the dependencyManagement section to specify the Protobuf version, but also ensure all protobuf modules are aligned to the same version

So it's close to your first suggestion, but rather than dependency manage a single protobuf artifact, import the BOM to make sure all protobuf modules are also updated to the version you want to use.

I have a summary of some of the strategies here: https://saturnism.me/talk/surviving-dependency-hell-maven/ . Specifically the reason I'd import the BOM is to avoid version misalignment issues.