java - Maven 错误,PKIX 路径构建失败 : unable to find valid certification path to requested target

标签 java maven

存在两个远程服务器。假设我们将它们命名为 A 和 B。 我的 java 代码已提交并在 GIT 存储库中保持最新。 我在服务器 A 和 B 上都提取了代码。当我在服务器 A 上使用 mvn clean package install 时,它正常工作并成功完成构建。 但是当我为服务器 B 使用 mvn clean package install 时,它给我以下错误消息和构建失败消息。

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] oagi-srt ........................................... SUCCESS [  0.292 s]
[INFO] oagi-srt-common .................................... SUCCESS [  1.959 s]
[INFO] oagi-srt-repository ................................ SUCCESS [  2.357 s]
[INFO] oagi-srt-service ................................... SUCCESS [  2.064 s]
[INFO] oagi-srt-import .................................... SUCCESS [  3.064 s]
[INFO] oagi-srt-webapp .................................... FAILURE [ 21.398 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31.539 s
[INFO] Finished at: 2017-08-10T11:50:10+00:00
[INFO] Final Memory: 44M/303M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project srt-webapp: Could not resolve dependencies for project org.oagi:srt-webapp:war:1.0.0: Failed to collect dependencies at org.joinfaces:jsf-spring-boot-starter:jar:2.2.7 -> org.primefaces.extensions:all-themes:jar:1.0.8 -> org.primefaces.themes:afterdark:jar:1.0.8: Failed to read artifact descriptor for org.primefaces.themes:afterdark:jar:1.0.8: Could not transfer artifact org.primefaces.themes:themes-project:pom:1.0.8 from/to prime-repo-new (http://repository.primefaces.org): sun.security.validator.ValidatorException: PKIX path building 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 switch.
[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 read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :srt-webapp

注意:- 如果我直接将项目 war 文件 放入 tomcat 并重新启动服务器,我的应用程序将在两台服务器上正常运行。

最佳答案

我公司的 IT 政策阻止了 maven repo https,因为证书过期日期很短。 导入证书很痛苦。所以我用这种方式来修复它:

  • 更改为最新的 maven(在版本 3.6.3 上验证)
  • 添加这些参数
mvn clean package -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true

关于java - Maven 错误,PKIX 路径构建失败 : unable to find valid certification path to requested target,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45612814/

相关文章:

java - 在 Android 中的蓝牙连接期间抛出的连接未创建(失败或中止)异常

java - Optaplanner - HardMediumSoftScoreHolder - 如何强制求解器首先最小化中等分数,然后最小化软分数?

java - 无法使用谷歌地图构建应用程序

java - 如何从一台机器针对另一台机器运行ant脚本?

java - Maven 在 Ubuntu 安装中使用旧插件

java - 如何减少 Solr 中多值字段的长度

java - 403访问禁止错误-当url具有动态路径参数时spring security

java - NoClassDefFoundError : org/w3c/dom/ls/DocumentLS - issue occurring only on deployment after having fixed it on compile time

eclipse - 在eclipse中新建maven项目时在构建路径中发现多个scala库

java - maven 忽略 jenv 设置