Tony
Tony

Reputation: 11

can not resolve spring cloud dependency when just import spring-boot-dependencies as pom

Version: springboot-2.0.0.RELEASE springcloud-Finchley.RC1

My project depend on spring-cloud-starter-netflix-eureka-client, when I declare spring-boot-starter-parent as the parent like below,Idea can resovle the version of eureka-client,

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

but when i import spring-boot-dependencies as pom like below ,Idea can not resovle the version of eureka-client, why?

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

The spring-boot-starter-parent-2.0.0.RELEASE.pom file almost only import spring-boot-dependencies at the head

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

plus,I import spring cloud like below

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

Upvotes: 0

Views: 1775

Answers (1)

DaShaun
DaShaun

Reputation: 3880

Maybe put the spring-cloud-dependencies into the dependencyManagement block like this:

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

Upvotes: 0

Related Questions