由于 InvalidAlgorithmParameterException,无法将工件从/向中心传输:trustAnchors 参数必须非空

当我尝试安装 maven 项目的 pom.xml 时,出现以下错误.请帮忙.

When I try to install the pom.xml of maven project, I get the following error. Please help.

在项目 pm 上执行目标 org.apache.maven.plugins:maven-resources-plugin:2.6:resources (default-resources) 失败:执行目标 org.apache.maven.plugins:maven-resources 的默认资源-plugin:2.6:resources failed: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 或其依赖项之一无法解析:无法从/到中央传输工件 classworlds:classworlds:jar:1.1 (https://repo.maven.apache.org/maven2): java.lang.RuntimeException:意外错误:java.security.InvalidAlgorithmParameterException:trustAnchors 参数必须为非空

Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.6:resources (default-resources) on project pm: Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:2.6:resources failed: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Could not transfer artifact classworlds:classworlds:jar:1.1 from/to central (https://repo.maven.apache.org/maven2): java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty

推荐答案

我在远程 CI 服务器上编译时遇到了同样的问题.最后,在使用 Maven 编译时强制 trustStore 的位置为我解决了这个问题:

I had the same issue when compiling on a remote CI server. In the end, forcing the location of the trustStore when compiling with Maven solved the problem for me:

<代码>-Djavax.net.ssl.trustStore=/usr/java/jdk1.8.0_91/jre/lib/security/cacerts

实际路径会根据您的 JDK 安装而有所不同.

The actual path will be different based on your JDK installation.

我推测(不确定)如果您有多个 JDK,某个旧的 JDK 没有正确的证书,并且即使您使用正确的 javac<,Maven 也会以某种方式拾取那个旧的/代码>

I speculate (not sure) that the problem arises if you have more than one JDK, some old one does not have proper certificate, and somehow Maven picks up that old one even if you are using the right javac

相关文章