在gitee上下载的项目,pom.xml中的maven依赖引入爆红
一、问题
(1)第一个报错
Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.2.4.RELEASE from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/2.2.4.RELEASE/spring-boot-starter-parent-2.2.4.RELEASE.pom
找了很多的方法,可能是版本的问题,我就将版本号改成了2.1.0,确实解决了这一个报错,Ctrl+点击spring-boot-starter-parent,也能正常跳转了,但是Ctrl+点击spring-boot-configuration-processor还是不行,出现了第二个报错
(2)第二个报错
Could not transfer artifact org.springframework.boot:spring-boot-dependencies:pom:2.1.0.RELEASE from/to central (https://repo.maven.apache.org/maven2): GET request of: org/springframework/boot/spring-boot-dependencies/2.1.0.RELEASE/spring-boot-dependencies-2.1.0.RELEASE.pom from central failed
问了chatgpt
1.首先报错的网站,我可以通过浏览器进入,说明我的网络是没有问题的;
2.我的镜像是阿里云
<mirrors>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>ui</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://uk.maven.org/maven2/</url>
</mirror>
<mirror>
<id>jboss-public-repository-group</id>
<mirrorOf>central</mirrorOf>
<name>JBoss Public Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public</url>
</mirror>
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
</mirror>
<mirror>
<id>OSChina</id>
<name>OSChina Central</name>
<url>http://maven.oschina.net/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>nexus-osc-thirdparty</id>
<mirrorOf>thirdparty</mirrorOf>
<name>Nexus osc thirdparty</name>
<url>http://maven.oschina.net/content/repositories/thirdparty/</url>
</mirror>
</mirrors>
[点击并拖拽以移动]
3.版本我也已经下降了
4.maven配置
idea的左上角的file->setting,然后按照图上的配置
-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true
5.释放缓存
最后问题还是没有解决!!!
二、解决方法
我发现我报错中的网址不是阿里云镜像网站,参考这个http://t.csdnimg.cn/DWgCi文章,在在项目的pom.xml
中添加如下配置
<repositories>
<repository>
<id>central</id>
<url>https://maven.aliyun.com/repository/public</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>https://maven.aliyun.com/repository/public</url>
</pluginRepository>
</pluginRepositories>
最后让maven重新加载,终于解决了爆红问题,依赖正常引入