Maven中Could not find artifact XXXX的错误解决
我目前碰到的是:
Could not find artifact com.alibaba.cloud:spring-cloud-alibaba-dependencies:pom:2.1.0 RELEASE in central
出现问题的原因其实很简单,写错了版本号!!2.1.0 RELEASE中间不该是空格而应该是.,即应该写成如下:
<dependencyManagement> <dependencies> <!-- spring cloud alibaba 2.1.0.RELEASE--> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-alibaba-dependencies</artifactId> <version>2.1.0.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency>
在Maven引入alibaba.cloud依赖时,可在父类pom进行指定应该如下:
<!-- 子模块继承后,提供作用:锁定版本 + 子module不用写groupId和version--> <dependencyManagement> <dependencies> <!-- springBoot 2.2.2 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version>2.2.2.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> <!-- spring cloud Hoxton.SR1 --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>Hoxton.SR1</version> <type>pom</type> <scope>import</scope> </dependency> <!-- spring cloud alibaba 2.1.0.RELEASE--> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-alibaba-dependencies</artifactId> <version>2.1.0.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> </dependencyManagement>
以上三个依赖基本都是在一起的,其中版本号自行制定即可,但一定不要写错了,不然后期很麻烦!
到此这篇关于Maven中Could not find artifact XXXX的错误解决的文章就介绍到这了,更多相关Maven Could not find artifact内容请搜索我们以前的文章或继续浏览下面的相关文章希望大家以后多多支持我们!
赞 (0)