Maven 构建问题:PKIX 路径构建失败

Maven build issue: PKIX path building failed

在我们使用 maven 构建的应用程序中,构建过程的一部分是检索存档中的文件以包含它们以供运行时使用。此存档托管在 sourceforge (here) 上,检索工作完美无缺,直到几周前,这条消息开始出现:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.8:run (process-resources-windows) on project ums-core: An Ant BuildException has occured: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[ERROR] around Ant part ...<get usetimestamp="true" src="http://downloads.sourceforge.net/project/ums-mlx/ums-tools/win32/transcode-tools-win32-20160915.tar.gz" dest="E:\dev\ums-mlx\ums-mlx\core/src/main/external-resources/transcode-tools/transcode-tools-win32-20160915.tar.gz"/>... @ 5:255 in E:\dev\ums-mlx\ums-mlx\core\target\antrun\build-main.xml

一些在线搜索让我找到了 this post 解释了如何将受信任的证书添加到 java 密钥库。

所以我检查了正在使用的证书:

导出证书(我以为被使用了):

并导入:

C:\Program Files\Java\jdk1.8.0_91\jre\bin>keytool -import -keystore ..\lib\security\cacerts -file c:\root.cer
Enter keystore password:
Certificate was added to keystore

第二次导入导致此消息:

C:\Program Files\Java\jdk1.8.0_91\jre\bin>keytool -import -keystore ..\lib\security\cacerts -file c:\root.cer
Enter keystore password:
keytool error: java.lang.Exception: Certificate not imported, alias <mykey> already exists

执行 keytool -list -keystore ..\lib\security\cacerts 时,会显示以下与 GeoTrust 相关的条目:

Line 53: geotrustuniversalca, 10-Dec-2009, trustedCertEntry,
Line 67: geotrustprimaryca, 10-Dec-2009, trustedCertEntry,
Line 133: geotrustglobalca, 18-Jul-2003, trustedCertEntry,
Line 169: geotrustprimarycag3, 10-Dec-2009, trustedCertEntry,
Line 171: geotrustprimarycag2, 10-Dec-2009, trustedCertEntry,

有人知道为了使构建过程再次运行缺少什么吗?

[edit] 使用的 maven 版本是:

E:\dev\ums-mlx\ums-mlx>mvn -v
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T18:29:23+01:00)
Maven home: C:\Program Files (x86)\apache-maven-3.2.5
Java version: 1.8.0_91, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_91\jre
Default locale: en_GB, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "dos"

原来是将 java jdk 升级到 8u121 解决了这个问题!?