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

时间:2020-03-26 07:42:26

标签: java maven netbeans pom.xml

每当我尝试构建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

JDK 1.8.0_181

Windows 10 Pro 10.0.18363

Maven 3.6.3

未配置代理->在其他网络中也尝试过

下班一周后,这个问题突然开始发生 开始构建之前的一周,每个构建都起作用了。甚至是全新的项目也会突然出现错误。

CMD行Maven命令也有此错误

重新安装Maven没有帮助

1 个答案:

答案 0 :(得分:1)

问题似乎是由于Java信任库(证书)损坏或配置错误而出现的。这里有一个答案,例如它是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。它可能指向腐败的托拉斯。以太更改它或指向默认的信任库。
相关问题