Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EnableEurekaServer import doesn't exist

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?

like image 346
Plasmaschnee Avatar asked Dec 25 '22 12:12

Plasmaschnee


2 Answers

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>
like image 111
vdimitrov Avatar answered Jan 07 '23 21:01

vdimitrov


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.

like image 44
cassiomolin Avatar answered Jan 07 '23 23:01

cassiomolin