Issues with maven dependencies: UnsolvableVersionConflictException

梦想的初衷 提交于 2021-01-29 08:43:47

问题


Im new in grpc and 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.grpc: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:

<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.


回答1:


Add a dependency on io.grpc:grpc-netty-shaded:jar:1.27.1 and io.grpc:grpc-services:jar:1.27.1. These artifacts aren't presently included in 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-all pulls in far more dependencies than many users need.



来源:https://stackoverflow.com/questions/60662804/issues-with-maven-dependencies-unsolvableversionconflictexception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!