背景
今天创建了一个spring boot的demo项目,发现maven一直拉取失败,用了两年一直没有问题,报了如下错误。
Non-resolvable parent POM for com.elysia:demo:0.0.1-SNAPSHOT: The following artifacts could not be resolved: org.springframework.boot:spring-boot-starter-parent:pom:3.2.7 (absent): org.springframework.boot:spring-boot-starter-parent:pom:3.2.7 failed to transfer from http://maven.aliyun.com/nexus/content/groups/public/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of alimaven has elapsed or updates are forced. Original error: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:3.2.7 from/to alimaven (http://maven.aliyun.com/nexus/content/groups/public/): Connect to archiva-maven-storage-prod.oss-cn-beijing.aliyuncs.com:443 [archiva-maven-storage-prod.oss-cn-beijing.aliyuncs.com/211.154.222.157] failed: Connect timed out and 'parent.relativePath' points at no local POM
看不懂,但根据经验从failed to transfer from http://maven.aliyun.com/nexus/content/groups/public/这里大致能看出是这个链接的问题。于是我去看了maven的配置。
<<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url><mirrorOf>central</mirrorOf>
</mirror>
解决
去阿里maven官网看了配置指南,发现改成了下面这样。
<mirror>
<id>aliyunmaven</id>
<mirrorOf>*</mirrorOf>
<name>阿里云公共仓库</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>
换源后顺利拉取。
评论区