IDEA2019.2版本,使用 maven3.6.2下载不了任何依赖和插件
下面内容列举了调试过程遇到的所有报错:
- Transfer failed for https://xxx
- PKIX path building failed xxx
- unable to find valid certification path to requested target
- Could not transfer artifact xxx
- Cannot resolve plugin xxx
花了两天的时间,尝试在网上找到的各种方案,有的说是证书问题,有的说是maven版本配置不一致问题,都不行,最后配置了以前使用的Maven3.3.3版本,竟然正常了,才意识到是不是IDEA的版本和maven的版本不兼容,再搜索这方面的信息,才定位到问题所在:
IDEA 2019.1.2版本与maven3.6.2和maven3.6.3冲突,所以maven降级为maven3.5.X的版本比较好。
做个记录,希望能够帮助大家,如果此方法还是不行,再去尝试自己添加证书,验证maven配置等操作。
PS:证书问题的缘由
Maven构建从2020年1月15日开始,禁用http。需要将存储库URL中的“ http:”替换为“ https:”。
问题截图
IDEA的报错日志
查看IEDA报错日志位置
报错日志
Caused by: java.lang.RuntimeException: org.apache.maven.wagon.TransferFailedException: Transfer failed for http://maven.aliyun.com/nexus/content/repositories/central/org/apache/maven/plugins/maven-site-plugin/3.3/maven-site-plugin-3.3.pom
… 24 more
Caused by: java.lang.RuntimeException: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:131)
… 24 more
Caused by: java.lang.RuntimeException: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at java.base/sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
… 67 more