配置maven无法下载(COULD NOT TRANSFER ARTIFACT ORG.APACHE.MAVEN.PLUGINS问题)
提示:下面是maven3.6.3版本百度云链接,记住maven3.3以上版本必须安装jdk1.7及以上版本,否则会出错。
链接:https://pan.baidu.com/s/1J0FNIBlF0JIm3QB9sIIlaA
提取码:4gud
问题描述:
在学习maven项目时,下载jar包一直出错,看了很多博客都不行,最后才知道是最开始看的那篇博客的镜像有问题,原地爆炸。
Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
解决方案:
1,查看settings配置中的镜像是否有问题
我们需要在settings中配置镜像,不然得享受蜗速,同时若是使用的过期镜像也会导致,我们不能下载maven包。具体操作如下:
配置阿里云镜像资源
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<!-- junit镜像地址 -->
<mirror>
<id>junit</id>
<name>junit Address/</name>
<url>http://jcenter.bintray.com/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
2,查看settings配置是否有问题
IDEA->setting里去找Maven,如下Maven home路径和之下的User settings file路径是否一致。不一致的话我们需要将我们解压的maven文件下的settings文件路径拷贝到对应的输入框。
3,更改idea中的证书问题
证书错误,访问https协议的网站,需要ssl认证才行,这里没有证书,我们可以用下面的方式忽略ssl检查导致的问题。
我们可以到IEDA->setting里,去找 Maven,在importing里加入如下的语句:
-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true
到这里基本就ok了如果证书问题还是解决不了,我们再向File - settings中的maven - Runner中添加这句话:
-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true -DarchetypeCatalog=internal
结语:
如果还是不行,可以再试试降低maven的版本,也有可能是maven版本、JDK和IDEA的版本不兼容,多试试降低版本试试。
最后祝各位大佬好运,写代码没有bug!