Home > Net >  Cannot resolve org.springframework.cloud:spring-cloud-starter-eureka-server:unknown
Cannot resolve org.springframework.cloud:spring-cloud-starter-eureka-server:unknown

Time:08-05

I'm learning spring-cloud and I'm having some problems writing the pom file. I get an error "Cannot resolve org.springframework.cloud:spring-cloud-starter-eureka-server:unknown".

I know if I add the version tag I can solve this problem, but I think it should automatically get the appropriate version number instead of making me write the version number.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>spring-cloud</artifactId>
    <version>1.0-SNAPSHOT</version>
    <modules>
        <module>eureka</module>
        <module>provider-1</module>
    </modules>

    <packaging>pom</packaging>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <skipTests>true</skipTests>
        <spring-cloud.version>Hoxton.SR12</spring-cloud.version>
    </properties>



    <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>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-eureka-server</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>2.3.12.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-eureka-server</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
        </dependency>
    </dependencies>

</project>

enter image description here

CodePudding user response:

Use this instead of

Current: What you are using.

<dependency>
  <groupId>org.springframework.cloud</groupId>
  <artifactId>spring-cloud-starter-eureka-server</artifactId>
</dependency>

Change to netflix: What you should use.

<dependency>
  <groupId>org.springframework.cloud</groupId>
  <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>

This dependencies has been renamed and netflix is included in the name.

From Edgaware release the naming convention has changed. Refer the release notes for more information.

https://github.com/spring-projects/spring-cloud/wiki/Spring-Cloud-Edgware-Release-Notes

and this naming convention is followed for further releases.

  • Related