第一次创建Maven项目失败
报错信息如下:
1 | 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 |
- 很多人说是maven路径和仓库路径不一致,可我的明显是一致的
- 然后又找到说是镜像的问题,我打开报错信息的网址https://repo.maven.apache.org/maven2发现可以打开,镜像应该没问题,不过我还是抱着试一试的心态,在maven的conf目录下setting.xml文件添加了阿里云的镜像。
1 2 3 4 5 6 | <mirror> <id>aliyunmaven</id> <mirrorOf>*</mirrorOf> <name>阿里云公共仓库</name> <url>https://maven.aliyun.com/repository/public</url> </mirror> |
然后果然还是不行。问题依然存在。
- 爆大招了,先不管这报错,我来运行一下:
不出意料的ERROR,但是,还是让我发现了不一样的东西:
1 2 3 4 5 6 7 8 9 10 11 12 13 | [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.917 s [INFO] Finished at: 2020-12-11T17:14:39+08:00 [INFO] ------------------------------------------------------------------------ [ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to aliyunmaven (https://maven.aliyun.com/repository/public): Transfer failed for https://maven.aliyun.com/repository/public/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException |
这是证书错误,访问https协议的网站,需要ssl认证才行,这里没有证书,我们可以用下面的方式忽略ssl检查导致的问题。
1 | -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true |