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

标签 spring spring-boot maven maven-2

需要有效的解决方案才能迁移到 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/

相关文章:

java - Spring - 在jsp文件上显示图像

java - Spring Validator 接口(interface)的 supports() 方法到底是如何工作的?

java - 如何在其他服务实现中从 Spring Security 接收经过身份验证的用户,而不是匿名用户。(Spring Security+JWT)

java - 从 IntelliJ 调用 Maven 模块构建

java - 找到接口(interface) org.apache.poi.util.POILogger,但预期类错误

javax.servlet.ServletException : java. lang.ClassCastException : XXX cannot be cast to spark. servlet.SparkApplication

java - Spring Restful 服务示例显示错误..!

java - Spring Boot 微服务连接 Kafka

java - 以下选项(@Service、@Bean 或 Static method)有什么区别

java - Validator 的 Spring 单元测试问题