Wednesday, February 12, 2020

http://repo1.maven.org/maven2/ return a 501 HTTPS Required

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


501 HTTPS Required. 
Use https://repo1.maven.org/maven2/
More information at https://links.sonatype.com/central/501-https-required
Requests to http://repo.maven.apache.org/maven2/ return a 501 HTTPS Required status and a body:
501 HTTPS Required. 
Use https://repo.maven.apache.org/maven2/
More information at https://links.sonatype.com/central/501-https-required
How do I satisfy this requirement so that I can regain access to Central?
E.g:
org.ostermiller:utils:jar:1.07.00 (compile)]: Failed to read artifact descriptor for com.fasterxml.jackson.core:jackson-databind:jar:2.2.3: Could not transfer artifact com.fasterxml.jackson.core:jackson-databind:pom:2.2.3 from/to central (http://repo.maven.apache.org/maven2): Failed to transfer http://repo.maven.apache.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.2.3/jackson-databind-2.2.3.pom. Error code 501, HTTPS Required

Solutions:
1. open your maven repository ${user.home}/.m2 folder and open the setting.xml if exist or else create a new one.
C:\Users\<user name\.m2
2. add the below entries in the setting.xml
<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>