尝试构建项目时出现以下错误:Failed to collect dependencies at org.msgpack:jackson-dataformat-msgpack:jar:0.8.17 -> com.fasterxml.jackson.core:jackson-databind:jar:2.9.9: Failed to read artifact descriptor for com.fasterxml.jackson.core:jackson-databind:jar:2.9.9: Could not transfer artifact com.fasterxml.jackson.core:jackson-databind:pom:2.9.9 from/to maven (https://repo1.maven.org/maven2): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
我读到问题出在http://repo1.maven.org/maven2上,我需要将其更改为https。做到这一点,仍然行不通。然后我在Google中找到了另一个建议->使用keytool添加Maven证书并重启。做到了。仍然不起作用。要求一位同事向我发送他们的回购信息,并且该信息可以正常使用(ofc,有所有依赖项)。然后,我想在我们的junit测试中介绍类别,因此我添加了surefire插件,这次问题是类似的:
<span style="background-color:#fefefe"><span style="color:#222222"><code>Unable to generate classpath: org.apache.maven.artifact.resolver.ArtifactResolutionException:
Unable to get dependency information for org.apache.maven.surefire:surefire-grouper:jar:2.12.4: Failed to retrieve POM for org.apache.maven.surefire:surefire-grouper:jar:2.12.4:
Could not transfer artifact org.apache.maven.surefire:surefire-grouper:pom:2.12.4 from/to maven (https://repo1.maven.org/maven2): sun.security.validator.ValidatorException:
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: u
nable to find valid certification path to requested target [ERROR] org.apache.maven.surefire:surefire-grouper:jar:2.12.4
[ERROR]
[ERROR] from the specified remote repositories:
[ERROR] maven (https://repo1.maven.org/maven2, releases=true, snapshots=true),
[ERROR] central (https://repo.maven.apache.org/maven2, releases=true, snapshots=false),
[ERROR] apache.snapshots (http://repository.apache.org/snapshots, releases=false, snapshots=true)
[ERROR] Path to dependency:
[ERROR] 1) dummy:dummy:jar:1.0
[ERROR] 2) org.apache.maven.surefire:surefire-junit47:jar:2.12.4
[ERROR] 3) org.apache.maven.surefire:common-junit48:jar:2.12.4
</code></span></span>
因此,我决定一个一个地下载,但这真是个地狱,我更喜欢解决此问题,而不是手动下载所有内容。
最佳答案
事实证明,问题出在我们的防火墙上-它以某种方式阻止了对所有Maven存储库的请求。当我要求IT人员停止它并对其进行测试时,maven能够从标准maven仓库(带有https的仓库)中下载所有内容。
关闭windows防火墙就好了