Could not find artifact org.springframework.cloud:spring-cloud-starter-consul-discovery:pom:unknown

bug日记#2

Could not find artifact org.springframework.cloud:spring-cloud-starter-consul-discovery:pom:unknown in nexus-aliyun (http://maven.aliyun.com/nexus/content/groups/public)

报错截图:

在这里插入图片描述

解决方法:

‘dependencies.dependency.version’ for org.springframework.cloud:spring-cloud-starter-consul-discovery:jar is missing.
报错原因显示没有加依赖版本
加入以下代码解决报错

    <!--spring cloud-->
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Finchley.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

在这里插入图片描述

原因

在Maven中dependencyManagement的作用其实相当于一个对所依赖jar包进行版本管理的管理器。
如果dependencies里的dependency自己没有声明version元素,那么maven就会到dependencyManagement里面去找有没有对该artifactId和groupId进行过版本声明,如果有,就继承它,如果没有就会报错,告诉你必须为dependency声明一个version

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值