EnableEurekaServer import doesn't exist

13,325

Solution 1

The following dependency worked for me:

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-netflix-eureka-server</artifactId>
    <version>1.1.6.RELEASE</version>
</dependency>

Solution 2

Assuming you use a bill of materials to manage Spring Cloud dependencies:

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

Just add the following depedency to your project:

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

Spring Cloud releases have names instead of numbers. And you must ensure that Spring Cloud version is compatible with the Spring Boot version you are using. See more details here.

Solution 3

Well if you are using gradle project, just add below dependency to your build.gradle file:

compile('org.springframework.cloud:spring-cloud-netflix-eureka-server')
Share:
13,325

Related videos on Youtube

Plasmaschnee
Author by

Plasmaschnee

Student-Programer at University of Science in Wedel, Germany

Updated on June 04, 2022

Comments

  • Plasmaschnee
    Plasmaschnee almost 2 years

    I build a Spring-Service with gradle and I wanted to use a Eureka-Server with it. My java-file looks like this:

    import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
    
    @EnableEurekaServer
    public class Welcome {
       ....
    }
    

    but when I try to build it with my gradle-file it says:

    org.springframework.cloud.netflix.eureka.server does not exist

    I searched for a solution for this problem but I seem to be alone with it. Does someone know why it is not working? Do I have to write something specific into the build.gradle-file?