无法下载/导入包 org.springframework.cloud.config.server.EnableConfigServer [英] Unable to download/import package org.springframework.cloud.config.server.EnableConfigServer

查看:40
本文介绍了无法下载/导入包 org.springframework.cloud.config.server.EnableConfigServer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 spring-cloud 概念的新手,并遵循了 spring.io 提供的 spring 云文档的每一步

这是我的配置详细信息:

STS:3.9.0

Maven : 3.5.0

Java:8

编辑 1:添加 pom.xml 文件

http://maven.apache.org/xsd/maven-4.0.0.xsd">4.0.0

com.example<artifactId>微服务</artifactId><version>0.0.1-SNAPSHOT</version><包装>罐</包装><name>微服务</name><description>Spring Boot 的演示项目</description><父母><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>1.5.2.RELEASE</version><相对路径/><!-- 从存储库中查找父级 --></父母><属性><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><java.version>1.8</java.version></属性><依赖项><依赖><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-</artifactId><!-- 在这里我没有看到下载 spring-cloud-starter-config 的选项--></依赖><依赖><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><范围>测试</范围></依赖></依赖项><依赖管理><依赖项><依赖><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-dependencies</artifactId><version>Camden.SR5</version><type>pom</type><范围>导入</范围></依赖></依赖项></dependencyManagement><构建><插件><插件><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></插件></plugins></build>

如果有人回答我的问题,那将非常有帮助.

解决方案

需要导入bom

<依赖项><依赖><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-dependencies</artifactId><version>Camden.SR7</version><type>pom</type><范围>导入</范围></依赖></依赖项></dependencyManagement>

I'm new to spring-cloud concepts and had followed each and every step of spring cloud document provided by spring.io

https://spring.io/guides/gs/centralized-configuration/

weird thing is when I do clt+space on spring-cloud- in my STS, I don't see any option to add spring-cloud-starter-config dependency in pom.xml file, as a result I couldn't able to import the package org.springframework.cloud.config.server.EnableConfigServer in my class file. I'm not understanding what would be the reason and why is it happening so.

Here are my configuration details:

STS : 3.9.0

Maven : 3.5.0

Java : 8

Edit 1: Adding pom.xml file

<?xml version="1.0" encoding="UTF-8"?>

http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0

<groupId>com.example</groupId>
<artifactId>MicroServices</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>MicroServices</name>
<description>Demo project for Spring Boot</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.2.RELEASE</version>
    <relativePath /> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-</artifactId> <!-- Here I don't see option to download spring-cloud-starter-config -->
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>Camden.SR5</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

It would be very much helpful If someone answers my question.

解决方案

You need to import the bom

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>Camden.SR7</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

这篇关于无法下载/导入包 org.springframework.cloud.config.server.EnableConfigServer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆