gpt4 book ai didi

java - Maven 依赖项失败并出现 501 错误

转载 作者:行者123 更新时间:2023-12-01 17:56:28 26 4
gpt4 key购买 nike

最近,在 Jenkins 中运行的 Maven 构建作业失败,并出现以下异常,表示它们无法从 Maven Central 提取依赖项,应该使用 HTTPS。我不确定如何将请求从 HTTP 更改为 HTTPS。有人可以指导我解决这个问题吗?

[ERROR] Unresolveable build extension:
Plugin org.apache.maven.wagon:wagon-ssh:2.1 or one of its dependencies could not be resolved:
Failed to collect dependencies for org.apache.maven.wagon:wagon-ssh:jar:2.1 ():
Failed to read artifact descriptor for org.apache.maven.wagon:wagon-ssh:jar:2.1:
Could not transfer artifact org.apache.maven.wagon:wagon-ssh:pom:2.1 from/to central (http://repo.maven.apache.org/maven2):
Failed to transfer file: http://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-ssh/2.1/wagon-ssh-2.1.pom.
Return code is: 501, ReasonPhrase:HTTPS Required. -> [Help 2]

Waiting for Jenkins to finish collecting data[ERROR]
Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.1 or one of its dependencies could not be resolved:
Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1:
Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.4.1 from/to central (http://repo.maven.apache.org/maven2):
Failed to transfer file: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom.
Return code is: 501 , ReasonPhrase:HTTPS Required. -> [Help 1]

最佳答案

观察到的错误的原因在Central 501 HTTPS Required中进行了解释。

Effective January 15, 2020, The Central Repository no longer supports insecure communication over plain HTTP and requires that all requests to the repository are encrypted over HTTPS.

看起来最新版本的 Maven(尝试过 3.6.0、3.6.1)已经默认使用 HTTPS URL。

以下是主要存储库切换的日期:

Your Java builds might break starting January 13th (if you haven't yet switched repo access to HTTPS)

更新:似乎从maven 3.2.3开始mavencentral是通过HTTPS访问的请参阅https://stackoverflow.com/a/25411658/5820670

Maven 更改日志(http://maven.apache.org/docs/3.2.3/release-notes.html)

关于java - Maven 依赖项失败并出现 501 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60707867/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com