close

[Solved] Requests to http://repo1.maven.org/maven2/ return a 501 HTTPS Required status and a body

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Requests to http://repo1.maven.org/maven2/ return a 501 HTTPS Required status and a body in java. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Requests to http://repo1.maven.org/maven2/ return a 501 HTTPS Required status and a body Error Occurs?

Today I get the following error Requests to http://repo1.maven.org/maven2/ return a 501 HTTPS Required status and a body in java.

How To Solve Requests to http://repo1.maven.org/maven2/ return a 501 HTTPS Required status and a body Error ?

  1. How To Solve Requests to http://repo1.maven.org/maven2/ return a 501 HTTPS Required status and a body Error ?

    To Solve Requests to http://repo1.maven.org/maven2/ return a 501 HTTPS Required status and a body Error If you can't fix it in parent pom, you can override parent pom's repo's, like this, in your child pom (extracted from the 3.6.3 default super pom, seems they changed the name from repo1 as well):

  2. Requests to http://repo1.maven.org/maven2/ return a 501 HTTPS Required status and a body

    To Solve Requests to http://repo1.maven.org/maven2/ return a 501 HTTPS Required status and a body Error If you can't fix it in parent pom, you can override parent pom's repo's, like this, in your child pom (extracted from the 3.6.3 default super pom, seems they changed the name from repo1 as well):

Solution 1

I fixed with the following steps but it uses http: 1) got to .m2 folder 2) create file settings.xml 3) copy paste below

<settings>
    <mirrors>
        <mirror>
          <id>centralhttps</id>
          <mirrorOf>central</mirrorOf>
          <name>Maven central https</name>
          <url>http://insecure.repo1.maven.org/maven2/</url>
        </mirror>
      </mirrors>
      </settings>

Solution 2

Beware that your parent pom can (re) define repositories as well, and if it has overridden central and specified http for whatever reason, you’ll need to fix that (so places to fix: ~/.m2/settings.xml AND also parent poms).

If you can’t fix it in parent pom, you can override parent pom’s repo’s, like this, in your child pom (extracted from the 3.6.3 default super pom, seems they changed the name from repo1 as well):

  <repositories>
    <repository>
      <id>central</id>
      <name>Central Repository</name>
      <url>https://repo.maven.apache.org/maven2</url> <!-- the https you've been looking for -->
      <layout>default</layout>
      <snapshots>
        <enabled>false</enabled> <!-- or set to false if desired, default is true https://stackoverflow.com/a/61684539/32453 -->
      </snapshots>
    </repository>
  </repositories>

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read

Leave a Comment