![](/img/trans.png)
[英]Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.22.2 from https://repo.maven.apache.org/maven2
[英]Maven cannot downlad dependencies/plugins from https://repo.maven.apache.org/maven2
尝试构建项目时出现以下错误:
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证书并重新启动。 做到了。 还是不行。 请一位同事将他们的 repo 发送给我并且它起作用了(ofc,有所有依赖项)。 然后我想在我们的junit测试中引入类别,所以我添加了surefire插件,这次问题是类似的:
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
所以我决定去一个一个下载,但这是一个地狱,我更喜欢解决这个问题而不是手动下载所有东西。
事实证明,问题出在我们的防火墙上——它以某种方式阻止了对所有 Maven 存储库的请求。 当我要求 IT 人员停止并对其进行测试时,maven 能够从标准 maven 存储库(带有 https 的存储库)下载所有内容
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.