Dennis P.
Dennis P.

Reputation: 35

Maven Error constructing implementation when Building Project

Whenever I try to build a Maven project I get the following Error:

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]

Trying to mvn clean leads to a similar 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 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]

Any idea what could solve the problem?

EDIT:

Netbeans 8.2

JDK 1.8.0_181

Windows 10 Pro 10.0.18363

Maven 3.6.3

No Proxy configured -> Also tried in different networks

Issue started happening suddenly after being a way from work for a week The week before it started every build worked. Suddenly even completely new projects get the error.

CMD line Maven commands also have this error

reinstalling Maven didn't help

Upvotes: 2

Views: 3740

Answers (1)

Dmitry.M
Dmitry.M

Reputation: 2962

It looks like the problem appears because of corrupted or misconfigured Java truststore (cacerts). Here we have an answer where for example it was corrupted.

The maven tries to download the resource plugin, creates https connection, receives SSL server certificate and tries to validate it against the java truststore.

The default truststore locates here JAVA_HOME->JRE->lib->security->cacerts (see answer)

I would suggest the following approach:

  1. Find out what truststore the maven uses.
  2. Download and update your java version. For example from 1.8.0_181 to jdk1.8.0_231 or the latest (or the same version) and change JAVA_HOME and PATH accordingly. If you have a problem with the corrupted truststore it should resolve it.
  3. Also, check that you don't have a misconfigured -Djavax.net.ssl.trustStoreType=pkcs12 parameter (should be jks).
  4. Check the parameter -Djavax.net.ssl.trustStore. It could point to the corrupted trustore. Ether change it or point to the defalut truststore.

Upvotes: 3

Related Questions