构建项目时 Maven 错误构建实现

Maven Error constructing implementation when Building Project

每当我尝试构建 Maven 项目时,我都会收到以下错误:

Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be 
resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6:
Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from/to central 
(https://repo.maven.apache.org/maven2): Transfer failed for 
https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-
plugin-2.6.pom: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: 
Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext): 
DerInputStream.getLength(): lengthTag=109, too big. -> [Help 1]

尝试 mvn clean 会导致类似的错误。

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 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: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, 
provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext): DerInputStream.getLength(): 
lengthTag=109, too big. -> [Help 1]

知道什么可以解决这个问题吗?

编辑:

Netbeans 8.2

JDK1.8.0_181

Windows 10 专业版 10.0.18363

行家 3.6.3

未配置代理 -> 也在不同的网络中尝试过

在下班一周后突然出现问题 开始前一周,每个构建都成功了。突然间,即使是全新的项目也会出错。

CMD行Maven命令也有这个错误

重新安装 Maven 没有帮助

问题的出现似乎是由于 Java 信任库 (cacerts) 损坏或配置错误。这里我们有一个答案,例如 corrupted.

maven 尝试下载资源插件,创建 https 连接,接收 SSL 服务器证书并尝试根据 java 信任库对其进行验证。

默认信任库位于此处 JAVA_HOME->JRE->lib->security->cacerts (see answer)

我建议采用以下方法:

  1. 找出 maven 使用的信任库。
  2. 下载并更新您的 java 版本。例如从 1.8.0_181 到 jdk1.8.0_231 或最新(或相同版本)并相应地更改 JAVA_HOME 和 PATH。如果您遇到损坏的信任库问题,它应该可以解决。
  3. 此外,请检查您是否没有配置错误 -Djavax.net.ssl.trustStoreType=pkcs12 parameter(应该是 jks)。
  4. 检查参数-Djavax.net.ssl.trustStore。它可能指向损坏的委托器。 Ether 更改它或指向默认信任库。