501 HTTPS的有效解析需要Maven build中用于移动到(http://repo1.maven.org/maven2 和 http://repo.spring.io)到HTTPS的错误?



需要高效的解决方案来迁移到HTTPS以mvn clean install成功构建

  • 具有许多内部依赖项的项目,这些依赖项使用http://repo1.maven.org/maven2http://repo.spring.io进行依赖项下载

我最后尝试了以下解决方案

  • ~/.m2/文件夹中添加了以下设置.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 依赖项仍然面临一些问题。

无法读取 的项目描述符 com.netflix.hystrix:hystrix-core:jar:1.5.13:无法传输 Artifact com.netflix.hystrix:hystrix-core:pom:1.5.13 from/to cxf-repo (http://repo1.maven.org/maven2/(: 传输失败 http://repo1.maven.org/maven2/com/netflix/hystrix/hystrix-core/1.5.13/hystrix-core-1.5.13.pom需要 501 HTTPS

  • 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 中央存储库移动到 HTTPS https://blog.sonatype.com/central-repository-moving-to-https但无法为内部依赖问题获得任何适当的解决方案。

在我的情况下,一些依赖项仍在调用中央和弹簧的http url 马文

升级你的 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>

备份.m2文件夹并进行清理和安装对我有用。

最新更新