好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

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中间不该是空格而应该是.,即应该写成如下:

?

1

2

3

4

5

6

7

8

9

10

< 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进行指定应该如下:

?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

<!-- 子模块继承后,提供作用:锁定版本 + 子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内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!

原文链接:https://blog.csdn.net/qq_36850342/article/details/117354125

查看更多关于Maven中Could not find artifact XXXX的错误解决的详细内容...

  阅读:55次