简体   繁体   English

Maven 依赖项的问题:UnsolvableVersionConflictException

[英]Issues with maven dependencies: UnsolvableVersionConflictException

Im new in grpc and java.我是 grpc 和 java 的新手。

I have a big problem with my dependencies:我的依赖项有一个大问题:

Caused by: org.eclipse.aether.collection.UnsolvableVersionConflictException: Could not resolve version conflict among [io.grpc:grpc-all:jar:1.27.1 -> io.grpc:grpc-core:jar:[1.27.1,1.27.1], io.grpc:grpc-all:jar:1.27.1 -> io.grpc:grpc-netty:jar:1.27.1 -> io.grpc:grpc-core:jar:[1.27.1,1.27.1], io.grpc:grpc-all:jar:1.27.1 -> io.grpc:grpc-okhttp:jar:1.27.1 -> io.grpc:grpc-core:jar:[1.27.1,1.27.1], io.grpc:grpc-all:jar:1.27.1 -> io.grpc:grpc-testing:jar:1.27.1 -> io.grpc:grpc-core:jar:[1.27.1,1.27.1], net.devh:grpc-spring-boot-starter:jar:2.6.2.RELEASE -> net.devh:grpc-server-spring-boot-starter:jar:2.6.2.RELEASE -> net.devh:grpc-server-spring-boot-autoconfigure:jar:2.6.2.RELEASE -> net.devh:grpc-common-spring-boot:jar:2.6.2.RELEASE -> io.grpc:grpc-core:jar:1.25.0, net.devh:grpc-spring-boot-starter:jar:2.6.2.RELEASE -> net.devh:grpc-server-spring-boot-starter:jar:2.6.2.RELEASE -> net.devh:grpc-server-spring-boot-autoconfigure:jar:2.6.2.RELEASE -> io.grpc:grpc-netty-shaded:jar:1.25.0 -> io.gr引起:org.eclipse.aether.collection.UnsolvableVersionConflictException:无法解决 [io.grpc:grpc-all:jar:1.27.1 -> io.grpc:grpc-core:jar:[1.27.1, 1.27.1], io.grpc:grpc-all:jar:1.27.1 -> io.grpc:grpc-netty:jar:1.27.1 -> io.grpc:grpc-core:jar:[1.27.1, 1.27.1], io.grpc:grpc-all:jar:1.27.1 -> io.grpc:grpc-okhttp:jar:1.27.1 -> io.grpc:grpc-core:jar:[1.27.1, 1.27.1], io.grpc:grpc-all:jar:1.27.1 -> io.grpc:grpc-testing:jar:1.27.1 -> io.grpc:grpc-core:jar:[1.27.1, 1.27.1], net.devh:grpc-spring-boot-starter:jar:2.6.2.RELEASE -> net.devh:grpc-server-spring-boot-starter:jar:2.6.2.RELEASE -> net .devh:grpc-server-spring-boot-autoconfigure:jar:2.6.2.RELEASE -> net.devh:grpc-common-spring-boot:jar:2.6.2.RELEASE -> io.grpc:grpc-core :jar:1.25.0, net.devh:grpc-spring-boot-starter:jar:2.6.2.RELEASE -> net.devh:grpc-server-spring-boot-starter:jar:2.6.2.RELEASE - > net.devh:grpc-server-spring-boot-autoconfigure:jar:2.6.2.RELEASE -> io.grpc:grpc-netty-shaded:jar:1.25.0 -> io.gr pc:grpc-core:jar:[1.25.0,1.25.0], net.devh:grpc-spring-boot-starter:jar:2.6.2.RELEASE -> net.devh:grpc-server-spring-boot-starter:jar:2.6.2.RELEASE -> net.devh:grpc-server-spring-boot-autoconfigure:jar:2.6.2.RELEASE -> io.grpc:grpc-services:jar:1.25.0 -> io.grpc:grpc-core:jar:[1.25.0,1.25.0]] pc:grpc-core:jar:[1.25.0,1.25.0], net.devh:grpc-spring-boot-starter:jar:2.6.2.RELEASE -> net.devh:grpc-server-spring-boot -starter:jar:2.6.2.RELEASE -> net.devh:grpc-server-spring-boot-autoconfigure:jar:2.6.2.RELEASE -> io.grpc:grpc-services:jar:1.25.0 -> io.grpc:grpc-core:jar:[1.25.0,1.25.0]]

My actual dependencies in pom file:我在 pom 文件中的实际依赖项:

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
        <version>2.2.4.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <version>2.2.4.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.session</groupId>
        <artifactId>spring-session-core</artifactId>
        <version>2.2.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <optional>true</optional>
        <version>1.18.12</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-core</artifactId>
        <version>5.2.2.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-mongodb</artifactId>
        <version>2.2.4.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>com.google.protobuf</groupId>
        <artifactId>protobuf-java-util</artifactId>
        <version>3.11.4</version>
    </dependency>
    <dependency>
        <groupId>com.google.protobuf</groupId>
        <artifactId>protobuf-java</artifactId>
        <version>3.11.4</version>
    </dependency>
    <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-all</artifactId>
        <version>1.27.1</version>
    </dependency>
    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>28.2-jre</version>
    </dependency>
    <dependency>
        <groupId>net.devh</groupId>
        <artifactId>grpc-spring-boot-starter</artifactId>
        <version>2.6.2.RELEASE</version>
    </dependency>
</dependencies>

Thanks for all recommendations.感谢您的所有建议。

Add a dependency on io.grpc:grpc-netty-shaded:jar:1.27.1 and io.grpc:grpc-services:jar:1.27.1 .添加对io.grpc:grpc-netty-shaded:jar:1.27.1 io.grpc:grpc-services:jar:1.27.1io.grpc:grpc-services:jar:1.27.1 These artifacts aren't presently included in grpc-all.这些工件目前不包含在 grpc-all 中。

    <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-netty-shaded</artifactId>
        <version>1.27.1</version>
    </dependency>
    <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-services</artifactId>
        <version>1.27.1</version>
    </dependency>

As a note, gRPC team would prefer you to avoid grpc-all and instead reference the specific dependencies you need;请注意,gRPC 团队希望您避免使用 grpc-all,而是引用您需要的特定依赖项; grpc-all pulls in far more dependencies than many users need. grpc-all 引入了比许多用户需要的更多的依赖项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM