![](/img/trans.png)
[英]Could not transfer artifact org.apache.maven.plugins:maven-surefire-plugin:pom:2.7.1 from/to central (http://repo1.maven.org/maven2)
[英]Maven Errror Could not transfer artifact org.apache.maven.plugins:maven-source-plugin:pom:3.0.1 from/to central
我正在尝试使用 maven 编译我的代码,出现以下错误,
i am using azure devops server and using build pipeline Maven Errror Could not transfer artifact org.apache.maven.plugins:maven-source-plugin:pom:3.0.1 from/to central
2021-02-26T11:43:14.4764714Z [ERROR] Plugin org.apache.maven.plugins:maven-source-plugin:3.0.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-source-plugin:jar:3.0.1: Could not transfer artifact org.apache.maven.plugins:maven-source-plugin:pom:3.0.1 from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-source-plugin/3.0.1/maven-source-plugin-3.0.1.pom ProxyInfo{host='12.3.4.59', userName='null', port=80, type='http', nonProxyHosts='null'}: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
根据错误信息:
Transfer failed for https://repo.maven.apache.org/maven2...unable to find valid certification path to requested target
It shows the Maven is trying to download an indirect dependency from Maven Central Repository located at https://repo.maven.apache.org/maven
2, which is a secured HTTP server (HTTPS) . 所以问题可能来自您的证书本身或您的网络。
对于证书,尝试https://repo.maven.apache.org/maven2
并下载证书,然后将其添加到 cacerts 中:
keytool -import -alias example -keystore .\cacerts -file example.cer
请尝试从该线程“PKIX 路径构建失败”和“无法找到请求目标的有效证书路径”中查看更多信息
对于网络,请尝试在您的浏览器上访问非常 URL 并检查它是否可以运行。 如果您真的无法从浏览器中使用 HTTPS 访问 Maven Central Repo,可能是因为您使用了一些阻止您下载服务器证书的代理规则。
您可以设置settings.xml文件如下所示:
<proxies>
<proxy>
<active>true</active>
<protocol>https</protocol>
<host>MY_COMPANY_HOST</host>
<port>8080</port>
<username>MY_USERNAME</username>
<password>MY_PASSWORD</password>
<nonProxyHosts>localhost</nonProxyHosts>
</proxy>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>MY_COMPANY_HOST</host>
<port>8080</port>
<username>MY_USERNAME</username>
<password>MY_PASSWORD</password>
<nonProxyHosts>localhost</nonProxyHosts>
</proxy>
</proxies>
并检查在代理后面使用 Maven 和 SSL 的线程问题以获取更多详细信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.