Trying to follow the example to create a Eureka Server. Followed the directions To run your own server use the spring-cloud-starter-eureka-server dependency and @EnableEurekaServer. My gradle is below

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.1.8.RELEASE")
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'

jar {
    baseName = 'gs-spring-boot'
    version =  '0.1.0'
}

repositories {
    mavenCentral()
    maven {
        url 'http://repo.spring.io/milestone'
    }
}

dependencies {
    // tag::jetty[]
    compile("org.springframework.boot:spring-boot-starter-web") {
        exclude module: "spring-boot-starter-tomcat"
    }
    compile("org.springframework.boot:spring-boot-starter-jetty")
    // end::jetty[]
    // tag::actuator[]
    compile("org.springframework.boot:spring-boot-starter-actuator")
    // end::actuator[]
//    compile 'org.springframework.cloud:spring-cloud-starter-eureka:1.0.0.M2'
    compile 'org.springframework.cloud:spring-cloud-starter-eureka-server:1.0.0.M2'
    testCompile("junit:junit")
}

task wrapper(type: Wrapper) {
    gradleVersion = '1.11'
}

However the @EnableEurekaServer annotation cannot be found

./gradlew clean build
:clean
:compileJava
/Users/jeff.morgan/Documents/workspace/spring-cloud/eureka/src/main/java/hello/Application.java:19: error: cannot find symbol
@EnableEurekaServer
 ^
  symbol: class EnableEurekaServer
1 error
:compileJava FAILED

Comment From: spencergibb

It worked for me with gradle 12 and this main class.

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableEurekaServer
@EnableAutoConfiguration
public class Application {
     public static void main(String[] args) {
          SpringApplication.run(Application.class, args);
     }
}

My compile command and results

gh-61% gradle clean build
:clean UP-TO-DATE
:compileJava
:processResources UP-TO-DATE
:classes
:jar
:bootRepackage
:assemble
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test UP-TO-DATE
:check UP-TO-DATE
:build

BUILD SUCCESSFUL

Total time: 6.456 secs

Comment From: jam1401

Hmm I actually think it is an issue with my IDE Intellij not re-syncing dependancies. When I added the import as you have it to my source and ran gradle it ran perfectly.

Clearly not a Spring-cloud issue I will close this issue. Thanks

Comment From: jasminejeane

Needed to have auto import enabled or add line import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; to code manually.

Comment From: kaleshrikant

Manual import and also :

eureka.client.registerWithEureka=false eureka.client.fetchRegistry=false

server.port=8888 eureka.client.serviceUrl.defaultZone: http://localhost:${server.port}/eureka/