Maven依赖项失败,出现501错误

问题描述 投票:3回答:2

最近在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]
java maven jenkins maven-central
2个回答
2
投票

从2020年1月15日起生效,中央存储库不再支持通过纯HTTP进行的不安全通信,并且要求通过HTTPS对存储库的所有请求进行加密。

如果收到此错误,则需要用其规范的HTTPS副本替换所有对Maven Central的URL引用:


1
投票

尝试在任何浏览器上点击以下网址,它将返回501

http://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-ssh/2.1/wagon-ssh-2.1.pom

请尝试使用https,它将下载pom.xml文件

https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-ssh/2.1/wagon-ssh-2.1.pom

请将其(https://repo.maven.apache.org/maven2)添加到setting.xml文件中希望它对你有用

© www.soinside.com 2019 - 2024. All rights reserved.