gpt4 book ai didi

spring - 有效解决 501 HTTPS Required Error in Maven Build for Moving (http ://repo1. maven.org/maven2 & http ://repo. spring.io) to HTTPS?

转载 作者:行者123 更新时间:2023-12-04 10:43:45 24 4
gpt4 key购买 nike

需要有效的解决方案才能迁移到 HTTPS 以确保 mvn clean install 构建成功

在我这边尝试了以下解决方案

  • ~/.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>

已阅读此文档以了解 ma​​ven 中央 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/

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