Reputation: 57
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?
Upvotes: 4
Views: 19803
Reputation: 61
Make sure that you havespring-cloud-starter-netflix-eureka-server
added in your pom.xml file
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
Upvotes: 0
Reputation: 11
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')
Upvotes: 1
Reputation: 135
Adding this dependency worked for me.
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-netflix-eureka-server</artifactId>
<version>3.1.2</version>
</dependency>
Upvotes: 1
Reputation: 1111
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>
Upvotes: 7
Reputation: 131157
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.
Upvotes: 3