首次运行 maven install 或任何一个插件时,报错:
Downloading from huaweicloud: https://repo.huaweicloud.com/repository/maven/org/apache/maven/plugins/maven-install-plugin/2.5/maven-clean-plugin-2.5.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.924 s
[INFO] Finished at: 2023-08-17T06:38:33+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-install-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 huaweicloud (https://repo.huaweicloud.com/repository/maven/): java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty -> [Help 1]
在IDE中报错信息很长不方便看,我只看了第一句,就是本文标题那句,看不出原因。静下心看到最后一句,才发现和https有关。
解决方法一是在file - settings - maven - runner 右边VM options : 添加
-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true
如此,不管是http协议的下载地址,还是国内一些https地址,都可以不报错。
解决方法二,同Java踩坑2,显然这个方法更安全一些。
标签:INFO,Java,plugin,Plugin,maven,plugins,apache,2.5 From: https://blog.51cto.com/u_6132776/7125771