需要有效的解决方案才能迁移到 HTTPS 以确保 mvn clean install
构建成功
- 拥有大量使用 http://repo1.maven.org/maven2 的内部依赖项的项目 & http://repo.spring.io 用于依赖下载
在我这边尝试了以下解决方案
在 ~/.m2/ 文件夹中添加了以下 settings.xml。还尝试了分析选项。
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> <localRepository>${user.home}/.m2/repository</localRepository> <interactiveMode/> <offline/> <pluginGroups/> <servers/> <mirrors> <mirror> <id>central-repository</id> <name>Maven Repository HTTPS</name> <url>https://repo1.maven.org/maven2</url> <mirrorOf>central</mirrorOf> </mirror> <mirror> <id>central-spring-repository</id> <name>Spring Repository HTTPS</name> <url>https://repo.spring.io</url> <mirrorOf>springcentral</mirrorOf> </mirror> <mirror> <id>organisation-repo1</id> <name>org-repo1</name> <url>http://org.maven.com/repo1</url> <mirrorOf>repo1</mirrorOf> </mirror> <mirror> <id>organisation-repo2</id> <name>org-repo2</name> <url>http://org.maven.com/repo2</url> <mirrorOf>repo2</mirrorOf> </mirror> </mirrors> <proxies/> <profiles/> <activeProfiles/> </settings>
在项目中仍然面临一些内部 jar 依赖的问题。
Failed to read artifact descriptor for com.netflix.hystrix:hystrix-core:jar:1.5.13: Could not transfer artifact com.netflix.hystrix:hystrix-core:pom:1.5.13 from/to cxf-repo (http://repo1.maven.org/maven2/): Transfer failed for http://repo1.maven.org/maven2/com/netflix/hystrix/hystrix-core/1.5.13/hystrix-core-1.5.13.pom 501 HTTPS Required
在 pom.xml
中添加了以下内容<repositories> <repository> <id>central-maven</id> <name>central https Releases</name> <url>https://repo.maven.apache.org/maven2</url> </repository> <repository> <id>central-spring</id> <name>central spring https Releases</name> <url>https://repo.spring.io</url> </repository> <repositories>
已阅读此文档以了解 maven 中央 repo 到 HTTPS 的移动 https://blog.sonatype.com/central-repository-moving-to-https 但无法为内部依赖性问题获得任何适当的解决方案。
Some dependencies in my case are still calling http url's of central and spring maven
最佳答案
要么升级你的Maven版本 或
通过修改您的 POM 来限制当前 Maven 版本使用 HTTPS 链接:
在项目的 pom.xml 中包含以下代码。
<project>
...
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
关于spring - 有效解决 501 HTTPS Required Error in Maven Build for Moving (http ://repo1. maven.org/maven2 & http ://repo. spring.io) to HTTPS?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59813987/