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

标签 java maven jenkins maven-central

最近在 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 maven central 是通过 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/59763531/

相关文章:

java - UDP 套接字编程(提取数据,将其存储在字符串中)

java - 使用Java在PostgreSQL上的Money数据

java - 组合 n 中大小为 k 的唯一组以满足特定要求的最佳方法

java - Mybatis源码项目构建报错: Non-resolvable parent POM

linux - Jenkins 上带有单声道的 MSBUILD

java - 接口(interface)使用和多态编码

java - 仅当 JNDI 资源可用时才在 JBoss 上部署 WAR 文件

java - Maven 和 IntelliJ 的 `-Dmaven.multiModuleProjectDirectory not set` 问题

git - jenkins 如何构建/克隆安装在其 docker 容器中的远程 git 存储库?

python - Sonar 未能获得 pylint 结果