не может разрешить зависимость Spring Cloud при импорте Spring-Boot-зависимостей как POM - PullRequest
0 голосов
/ 28 апреля 2018

Версия: springboot-2.0.0.RELEASE springcloud-Finchley.RC1

Мой проект зависит от spring-cloud-starter-netflix-eureka-client, когда я объявляю spring-boot-starter-parent в качестве родителя, как показано ниже, Idea может восстановить версию eureka-client,

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.0.RELEASE</version>
</parent>

но когда я импортирую spring-boot-зависимости как pom, как показано ниже, Idea не может восстановить версию eureka-client, Зачем?

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>2.0.0.RELEASE</version>
        <type>pom</type>
        <scope>import</scope>
    </dependency>

Файл spring-boot-starter-parent-2.0.0.RELEASE.pom почти только импортирует spring-boot-dependencies в заголовке

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-dependencies</artifactId>
    <version>2.0.0.RELEASE</version>
    <relativePath>../../spring-boot-dependencies</relativePath>
</parent>

плюс, я импортирую весеннее облако, как показано ниже

<dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-dependencies</artifactId>
        <version>Finchley.RC1</version>
        <type>pom</type>
        <scope>import</scope>
    </dependency>

1 Ответ

0 голосов
/ 28 апреля 2018

Возможно, поместите spring-cloud-dependencies в блок dependencyManagement следующим образом:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>${spring-cloud.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>
...