首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法解析EnableEurekaServer在intelliJ中的符号。是的,我的依赖/失效+重新启动了我的IDE)

无法解析EnableEurekaServer在intelliJ中的符号。是的,我的依赖/失效+重新启动了我的IDE)
EN

Stack Overflow用户
提问于 2018-03-16 19:55:15
回答 3查看 5.8K关注 0票数 2

I‘.’对不起,如果我不懂某些单词的话.

我一直有错误:无法解析符号@EnableEurekaServer.当我手动输入eureka服务器的导入行时,"cloud“一词被突出显示为红色:

代码语言:javascript
运行
复制
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;

在我的build.gradle文件中

代码语言:javascript
运行
复制
compile('org.springframework.cloud:spring-cloud-netflix-eureka-server')

为什么会发生这种事。一切看起来都正常。我可以提供截图的东西,如果有人问!

我的build.gradle文件如下所示:

代码语言:javascript
运行
复制
buildscript {
    ext {
        springBootVersion = '2.0.0.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    compile('org.springframework.cloud:spring-cloud-netflix-eureka-server')
    compile('org.springframework.boot:spring-boot-starter-web')
    testCompile('org.springframework.boot:spring-boot-starter-test')
}

我的EurekaApplicationServer.java看起来是这样的:

代码语言:javascript
运行
复制
package com.example.eurekaserver;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
//import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;

@SpringBootApplication
public class EurekaApplicationServer {

    public static void main(String[] args) {
        SpringApplication.run(EurekaApplicationServer.class, args);
    }

}

错误图片

EN

Stack Overflow用户

发布于 2018-09-30 08:42:18

没有必要降低eureka服务器/客户端的版本。原因是maven repo无法解决eureka server.To的最新版本,请将存储库添加到pom/gradle文件中。

代码语言:javascript
运行
复制
repositories {
    maven {
        url 'https://repo.spring.io/libs-milestone'
    }
}

代码语言:javascript
运行
复制
<repositories>
    <repository>
       <id>spring-milestones</id>
       <name>Spring Milestones</name>
       <url>https://repo.spring.io/libs-milestone</url>
       <snapshots>
           <enabled>false</enabled>
       </snapshots>
   </repository>

票数 -1
EN
查看全部 3 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49328567

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档