Maven Could not find artifact

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

Maven Could not find artifact

那就努力吖   2022-05-23 我要评论

我目前碰到的是:

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>

以上三个依赖基本都是在一起的,其中版本号自行制定即可,但一定不要写错了,不然后期很麻烦!

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们