maven PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path

maven编译的时候遇到的奇葩问题,  非常奇葩, 所有其他同事都没有遇到 , 仅仅是我遇到了

不清楚是因为用了最新的JDK的缘故(1.8 update91)还是其他什么原因. 总之是证书的问题.

当时的情况是maven去公司的nexus中心下文件 , nexus是以https开头的地址.下载的时候就出现了上面的问题.

解决办法如下 :

1.下载证书

  1.1在web浏览器上(这里我用的是chrome)打开https的链接,然后点击https前面的小锁头,然后点详细信息.就可以看到右侧有一些信息.然后点击view certificate.直接拖拽证书的图标到一个路径,就保存下来了.这里我的文件叫nexus.rc.dataengine.com.cer

2.进入JDK的security路径

  cd $JAVA_HOME/jre/lib/securiy

3.执行命令导入证书

  sudo keytool -keystore cacerts -importcert -alias nexussecureca -file /Users/kane/nexus.rc.dataengine.com.cer

遇到输入口令的情况 , java的默认口令是changeit

原文地址:https://www.cnblogs.com/taojintianxia/p/5546854.html