Could not find artifact org.springframework.boot:spring-boot-starter-parent:jar

1.问题的背景

在创建Springboot工程时,引入了org.springframework.boot的spring-boot-starter-parent和spring-boot-starter-web,但是提示找不到spring-boot-starter-parent 的jar包,而spring-boot-starter-web的jar包可以找到,配置的是阿里云的maven仓库。

报错内容:

Could not find artifact org.springframework.boot:spring-boot-starter-parent:jar:2.7.7 in nexus-aliyun (http://maven.aliyun.com/nexus/content/groups/public)

2. 分析问题

配置的阿里云maven仓库,其他都可以,只有spring-boot-starter-parent报错,于是在maven中央仓库(https://repo.maven.apache.org/maven2/)中寻找,只找到了spring-boot-starter-parent的pom没有jar包,spring-boot-starter-web目录下既有.pom也有jar包,所以starter-web不报错。

(也可以在https://mvnrepository.com/里面搜索)

3. 解决办法

由于maven仓库中没有spring-boot-starter-parent相关的jar包,于是不能全部引入,需要在依赖中指定type。

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.7.7</version>
            <type>pom</type>
        </dependency>

结果:

总结:

如果maven中央仓库没有jar包,即使更换任意镜像,设置安全校验都不好使,可以现在maven中央仓库看是否有所缺的jar包

版权声明:本文为博主作者:qq_865326685原创文章,版权归属原作者,如果侵权,请联系我们删除!

原文链接:https://blog.csdn.net/a1004314120/article/details/128584548

共计人评分,平均

到目前为止还没有投票!成为第一位评论此文章。

(0)
扎眼的阳光的头像扎眼的阳光普通用户
上一篇 2024年1月11日
下一篇 2024年1月11日

相关推荐