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

Effective January 15, 2020, The Central Repository no longer supports insecure communication over plain HTTP and requires that all requests to the repository are encrypted over HTTPS.

If you're receiving this error, then you need to replace all URL references to Maven Central with their canonical HTTPS counterparts:

Replace http://repo1.maven.org/maven2/ with https://repo1.maven.org/maven2/

Replace http://repo.maven.apache.org/maven2/ with https://repo.maven.apache.org/maven2/

If for any reason your environment cannot support HTTPS, you have the option of using our dedicated insecure endpoint at http://insecure.repo1.maven.org/maven2/

For further context around the move to HTTPS, please see https://blog.sonatype.com/central-repository-moving-to-https.


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>

Try to add the next statament in your pom.xml

<pluginRepositories>
<pluginRepository>
  <id>central</id>
  <name>Central Repository</name>
  <url>https://repo.maven.apache.org/maven2</url>
  <layout>default</layout>
  <snapshots>
    <enabled>false</enabled>
  </snapshots>
  <releases>
    <updatePolicy>never</updatePolicy>
  </releases>
</pluginRepository>
</pluginRepositories>

<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>

Also, you have to specified the repositories in: MAVEN\conf\settings.xml

<mirrors>
 <mirror>
   <id>other-mirror</id>
   <mirrorOf>central</mirrorOf>
   <name>Other Mirror Repository</name>
   <url>http://insecure.repo1.maven.org/maven2/</url>
 </mirror>
 <mirror>
  <id>internal-repository</id>
  <name>Maven Repository Manager running on https://repo1.maven.org/maven2</name>
  <url>https://repo1.maven.org/maven2</url>
  <mirrorOf>*</mirrorOf>
 </mirror>
</mirrors>