当我尝试构建项目时出现以下错误:
无法在 org.msgpack:jackson-dataformat-msgpack:jar:0.8.17 -> com.fasterxml.jackson.core:jackson-databind:jar:2.9.9 处收集依赖项:无法读取 Artifact com.fasterxml.jackson.core的描述符:jackson-databind:jar:2.9.9:无法从/到maven传输 Artifact com.fasterxml.jackson.core:jackson-databind:pom:2.9.9(https://repo1.maven.org/maven2): sun.security.validator.ValidatorException: PKIX 路径构建失败: sun.security.provider.certpath.SunCertPathBuilderException: 无法找到请求目标的有效证书路径
我读到问题出在 http://repo1.maven.org/maven2 上我需要将其更改为https。搞定了,还是不行。然后我在google中找到了另一个建议->使用keytool添加maven证书并重新启动。做到了。还是不行。让一位同事向我发送他们的存储库,它起作用了(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 的存储库)下载所有内容
关于java - Maven 无法从 https ://repo. maven.apache.org/maven2 下载依赖项/插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60300627/