[WARNING] Could not transfer metadata org.apache.commons:commons-imaging:1.0-SNAPSHOT

澹台奇略
2023-12-01

1、描述

最近从Github上下载原先升级为Maven的项目,结果控制台一直报错,clean和update也没有解决。经过分析异常信息,最终原因是maven-metadata.xml没有正常下载。其中根本原因是异常中的https://repository.apache.org/content/repositories/snapshots/不能下载commons-imaging。
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException 这是缺少安全证书时出现的异常,解决方案就是将你要访问的webservice的安全认证证书导入到客户端即可。试过安装证书,但在虚拟机里不能操作,没有权限。

[INFO] Scanning for projects...
[INFO] 
[INFO] ----------------------------< com.hgc:fas2 >----------------------------
[INFO] Building fas2 0.0.1-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO] Downloading from : https://repository.apache.org/content/repositories/snapshots/org/apache/commons/commons-imaging/1.0-SNAPSHOT/maven-metadata.xml
[WARNING] Could not transfer metadata org.apache.commons:commons-imaging:1.0-SNAPSHOT/maven-metadata.xml from/to apache.snapshots (https://repository.apache.org/content/repositories/snapshots/): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[WARNING] Failure to transfer org.apache.commons:commons-imaging:1.0-SNAPSHOT/maven-metadata.xml from https://repository.apache.org/content/repositories/snapshots/ was cached in the local repository, resolution will not be reattempted until the update interval of apache.snapshots has elapsed or updates are forced. Original error: Could not transfer metadata org.apache.commons:commons-imaging:1.0-SNAPSHOT/maven-metadata.xml from/to apache.snapshots (https://repository.apache.org/content/repositories/snapshots/): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[INFO] Downloading from : https://repository.apache.org/content/repositories/snapshots/org/apache/commons/commons-imaging/1.0-SNAPSHOT/commons-imaging-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.855 s
[INFO] Finished at: 2019-08-23T15:43:30+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project fas2: Could not resolve dependencies for project com.hgc:fas2:war:0.0.1-SNAPSHOT: Failed to collect dependencies at com.itextpdf:itext-xtra:jar:5.5.10 -> org.apache.commons:commons-imaging:jar:1.0-SNAPSHOT: Failed to read artifact descriptor for org.apache.commons:commons-imaging:jar:1.0-SNAPSHOT: Could not transfer artifact org.apache.commons:commons-imaging:pom:1.0-SNAPSHOT from/to apache.snapshots (https://repository.apache.org/content/repositories/snapshots/): 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

2、解决

在settings.xml中添加repositories,http://jump-pilot.sourceforge.net/repository/org/apache/commons/commons-imaging/1.0-SNAPSHOT/ 可以直接访问链接。如果出现解析不了的情况,大部分是下载链接不对。

<repositories>
	<repository>
		<id>jump-pilot</id>
		<name>central</name>
		<url>http://jump-pilot.sourceforge.net/repository</url>
	</repository>	
</repositories>
 类似资料: