0

我有一个数据流管道,可以使用谷歌云自然语言 API 进行情感分析。所以,我包括云语言和数据流运行器的 jar,如下所示:

<dependency>
  <groupId>com.google.cloud</groupId>
  <artifactId>google-cloud-language</artifactId>
  <version>1.25.0</version>
</dependency>

<dependency>
    <groupId>org.apache.beam</groupId>
    <artifactId>beam-runners-google-cloud-dataflow-java</artifactId>
    <version>2.4.0</version>
</dependency>

但问题是,依赖项有崩溃

云语言使用 io.grpc 1.10.1,而 beam sdk 使用 1.2.0。有什么办法可以解决吗?谢谢。

com.google.cloud:google-cloud-language:jar:1.25.0 -> io.grpc:grpc-stub:jar:1.10.1 -> io.grpc:grpc-core:jar:1.10.1

org.apache.beam:beam-sdks-java-io-google-cloud-platform:jar:2.4.0 -> io.grpc:grpc-core:jar:1.2.0,

详细日志:

[ERROR] Failed to execute goal on project apache-beam-loader: Could not resolve dependencies for project com.sample.cloud:apache-beam-loader:jar:0.0.1-SNAPSHOT: Failed to collect dependencies for com.sample.cloud:apache-beam-loader:jar:0.0.1-SNAPSHOT: Could not resolve version conflict among [org.apache.beam:beam-runners-google-cloud-dataflow-java:jar:2.4.0 -> org.apache.beam:beam-sdks-java-io-google-cloud-platform:jar:2.4.0 -> io.grpc:grpc-core:jar:1.2.0, org.apache.beam:beam-runners-google-cloud-dataflow-java:jar:2.4.0 -> org.apache.beam:beam-sdks-java-io-google-cloud-platform:jar:2.4.0 -> io.grpc:grpc-netty:jar:1.2.0 -> io.grpc:grpc-core:jar:[1.2.0,1.2.0], org.apache.beam:beam-runners-google-cloud-dataflow-java:jar:2.4.0 -> org.apache.beam:beam-sdks-java-io-google-cloud-platform:jar:2.4.0 -> io.grpc:grpc-all:jar:1.2.0 -> io.grpc:grpc-core:jar:[1.2.0,1.2.0], org.apache.beam:beam-runners-google-cloud-dataflow-java:jar:2.4.0 -> org.apache.beam:beam-sdks-java-io-google-cloud-platform:jar:2.4.0 -> io.grpc:grpc-all:jar:1.2.0 -> io.grpc:grpc-okhttp:jar:1.2.0 -> io.grpc:grpc-core:jar:[1.2.0,1.2.0], org.apache.beam:beam-runners-google-cloud-dataflow-java:jar:2.4.0 -> org.apache.beam:beam-sdks-java-io-google-cloud-platform:jar:2.4.0 -> io.grpc:grpc-all:jar:1.2.0 -> io.grpc:grpc-protobuf-lite:jar:1.2.0 -> io.grpc:grpc-core:jar:1.2.0, org.apache.beam:beam-runners-google-cloud-dataflow-java:jar:2.4.0 -> org.apache.beam:beam-sdks-java-io-google-cloud-platform:jar:2.4.0 -> io.grpc:grpc-all:jar:1.2.0 -> io.grpc:grpc-protobuf-nano:jar:1.2.0 -> io.grpc:grpc-core:jar:1.2.0, org.apache.beam:beam-runners-google-cloud-dataflow-java:jar:2.4.0 -> org.apache.beam:beam-sdks-java-io-google-cloud-platform:jar:2.4.0 -> com.google.cloud.bigtable:bigtable-protos:jar:1.0.0-pre3 -> io.grpc:grpc-core:jar:1.5.0, org.apache.beam:beam-runners-google-cloud-dataflow-java:jar:2.4.0 -> org.apache.beam:beam-sdks-java-io-google-cloud-platform:jar:2.4.0 -> com.google.cloud.bigtable:bigtable-client-core:jar:1.0.0 -> io.grpc:grpc-core:jar:1.7.0, org.apache.beam:beam-runners-google-cloud-dataflow-java:jar:2.4.0 -> org.apache.beam:beam-sdks-java-io-google-cloud-platform:jar:2.4.0 -> com.google.cloud.bigtable:bigtable-client-core:jar:1.0.0 -> io.opencensus:opencensus-contrib-grpc-util:jar:0.7.0 -> io.grpc:grpc-core:jar:1.6.1, com.google.cloud:google-cloud-language:jar:1.25.0 -> com.google.cloud:google-cloud-core-grpc:jar:1.25.0 -> io.grpc:grpc-protobuf:jar:1.10.1 -> io.grpc:grpc-core:jar:1.10.1, com.google.cloud:google-cloud-language:jar:1.25.0 -> io.grpc:grpc-netty-shaded:jar:1.10.1 -> io.grpc:grpc-core:jar:[1.10.1,1.10.1], com.google.cloud:google-cloud-language:jar:1.25.0 -> io.grpc:grpc-stub:jar:1.10.1 -> io.grpc:grpc-core:jar:1.10.1, com.google.cloud:google-cloud-language:jar:1.25.0 -> io.grpc:grpc-auth:jar:1.10.1 -> io.grpc:grpc-core:jar:[1.10.1,1.10.1]] -> [Help 1]
4

1 回答 1

0

我有完全相同的问题。您可以通过使用早期版本的 google-cloud-language 来解决它,虽然不理想,但如果您不需要自然语言 API 的新功能,则可以使用。

    <dependency>
        <groupId>com.google.cloud</groupId>
        <artifactId>google-cloud-language</artifactId>
        <version>0.20.0-beta</version>
    </dependency>

0.20.0-beta 正在使用 io.grpc:grpc-core:jar:1.2.0。看看它是否适合你。

于 2018-07-08T07:29:34.507 回答