0
votes

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>
1
That is the documented way to use spring cloud. Spring boot knows nothing about it. - spencergibb
I updated my question,the spring-boot-starter-parent-2.0.0.RELEASE.pom file almost only import spring-boot-dependencies at the head of the file,so I think the two way should be both OK. - Tony
Hey, have you found a solution at the end? I search this problem and hit here, a year later when this was post, still see no solution. lol - n4feng

1 Answers

0
votes

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>