前提知识:
我的IDEA版本:
maven 本地仓库地址默认在C盘 C:\Users\Lenovo\.m2\repository,也可以自己在IDEA中设置到D盘中
(下载IDEA时,IDEA自动在C盘创建的本地仓库会有下载一些基本用的依赖,因此你重新移动到其他盘时会重新下载一些)
同理 maven也会自动下载版本,也可以设置为你自己下载的maven版本
设置位置:File-Settings
回归正题
这位博主的博客帮了我大忙!!
https://blog.csdn.net/jwcxs_m/article/details/80076909
但是其中我还是在第3步的时候出现了博主没有出现的问题:
我在settings.xml中设置使用的是阿里云的仓库
<mirror>
<id>nexus-aliyun</id>
<name>Nexus aliyun</name>
<url>https://maven.aliyun.com/repository/public</url>
<mirrorOf>central</mirrorOf>
</mirror>
然后报错:
Could not transfer artifact org.apache.maven.plugins:spring-boot-starter-parent:pom:2.1.2.REALSE
from/to alimaven (https://maven.aliyun.com/repository/central):
sun.security.validator.ValidatorException: PKIX
path building failed: sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification path to requested target
这就要感谢这位博主:https://www.cnblogs.com/shwang/p/12090894.html
在File-settings-Build,Excution,...-Build Tools-Maven-Runner-VM Options 设置参数:
-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true
如图:
然后就终于开始下载,喜极而泣啊!!
之后右侧栏目maven-dependencies有爆红,重启idea后就没有了,pom.xml中爆红的依赖也都有了!!
最后
多记录几个远程仓库
<!--两个可用的mirror站点-->
<!--
<mirror>
<id>nexus</id>
<name>internal nexus repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
-->
<!-- 阿里云的镜像站(首推,新站,速度暴快)顺便给阿里云栖开发者社区做个广告,点这里来云栖社区看看吧。-->
<mirror>
<id>nexus-aliyun</id>
<name>Nexus aliyun</name>
<url>https://maven.aliyun.com/repository/public</url>
<mirrorOf>central</mirrorOf>
</mirror>
<!-- 剩下就是国外的了,maven官方运维的2号仓库 -->
<mirror>
<id>repo2</id>
<name>Mirror from Maven Repo2</name>
<url>http://repo2.maven.org/maven2/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<!-- maven在UK架设的仓库(有时候速度会比官方2号仓库快) -->
<mirror>
<id>ui</id>
<name>Mirror from UK</name>
<url>http://uk.maven.org/maven2/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<!-- JBoss的仓库 -->
<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>