`
truth99
  • 浏览: 61370 次
  • 性别: Icon_minigender_1
社区版块
存档分类
最新评论

Maven编译打包时报“PKIX path building failed”异常解决方法

阅读更多

现在用intellij idea集成开发工具的人越来越多,所以今天我也想弄弄这个开发工具。
在编译maven项目的时候报了一个异常,在网上搜了一些文章最终将问题解决了,在此记录下来方便以后查阅。


异常代码如下:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project Learn_design-pattern: Execution default-compile of goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile failed: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.5.1 or one of its dependencies could not be resolved: Failed to collect dependencies at org.apache.maven.plugins:maven-compiler-plugin:jar:2.5.1 -> org.codehaus.plexus:plexus-compiler-api:jar:1.9.1: Failed to read artifact descriptor for org.codehaus.plexus:plexus-compiler-api:jar:1.9.1: Could not transfer artifact org.codehaus.plexus:plexus-compiler-api:pom:1.9.1 from/to nexus (https://maven.xxx.com/nexus/content/groups/public): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]


主要是这段错误信息:

from/to nexus (https://maven.xxx.com/nexus/content/groups/public): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

由于访问"maven.xxx.com"域名时需要安全证书,所以生成一个证书就可以了。

解决方法也很简单:
1. 下载InstallCert.java,见附件
2. 在命令行下进入InstallCert.java所在文件夹
3. 编译InstallCert.java文件,执行InstallCert:

4. 执行上图命令后会打出下图信息:

5. 输入“1”回车后,会在当前文件夹下生成“jssecacerts”的文件
6. 将“jssecacerts”的文件放入JAVA_HOME/jre/lib/security目录下

再进行maven编译就可以了。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics