mvn clean: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException

6.7k views Asked by At

Using the correct settings.xml file, but while executing mvn clean command getting below errors:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building myproject 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven
-source-plugin/2.2/maven-source-plugin-2.2.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.290 s
[INFO] Finished at: 2017-01-02T16:16:12+05:30
[INFO] Final Memory: 10M/155M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-source-plugin:2.2 or one of its de
pendencies could not be resolved: Failed to read artifact descriptor for org.apa
che.maven.plugins:maven-source-plugin:jar:2.2: Could not transfer artifact org.a
pache.maven.plugins:maven-source-plugin:pom:2.2 from/to central (https://repo.ma
ven.apache.org/maven2): sun.security.validator.ValidatorException: PKIX path bui
lding failed: sun.security.provider.certpath.SunCertPathBuilderException: unable
 to find valid certification path to requested target -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResoluti
onException

What are the problems caused for this error PKIX path bui lding failed: sun.security.provider.certpath.SunCertPathBuilderException?

2

There are 2 answers

2
Tobias On

The certificate exposed by https://repo.ma ven.apache.org/maven2 is not valid on your machine. Perhaps you have removed certificates from your Java truststore or have changed your local time to a future date?

0
positivecrux On

You need to install your network's root SSL certificate to jre cacerts to solve this issue.

You may find detailed steps to perform this task here.

Some points to take care of

  1. Certificate which you install in your cacerts must be root certificate.
  2. Make sure you are making changes to correct JRE.
  3. cacerts default password is changeit.
  4. Install JDK on system and refer it to IDE.Avoid using bundled version.