ARTIFACTORY: How to resolve "Blocked mirror for repositories" error while resolving Maven dependencies through Artifactory?

ARTIFACTORY: How to resolve "Blocked mirror for repositories" error while resolving Maven dependencies through Artifactory?

AuthorFullName__c
Ganavi K
articleNumber
000005840
FirstPublishedDate
2023-08-08T11:41:42Z
lastModifiedDate
2025-05-15
VersionNumber
6

With the release of Maven 3.8.1, it has been made strict that the external HTTP URLs defined under the POM would be blocked.

Symptoms:
In such cases, while trying to resolve the artifacts through the client or the CI servers, it would return an error message of the following pattern.
User-added image

Solution:
In order to fix this error, it is highly recommended to upgrade the corresponding HTTP repository URL with HTTPs. 

If the enablement of secure gateway (HTTPs) is not an option for some reason, the alternate way is to hardcode the HTTP urls inside the ~/.m2/settings.xml with the mirrorOf attribute to redirect the request to the required HTTP url.

Here is a sample definition of such a workaround followed to achieve the artifact resolution against a repository enabled with HTTP.

<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 http://maven.apache.org/xsd/settings-1.2.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.2.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <servers>
    <server>
      <username>USERNAME</username>
      <password>PASSWORD</password>
      <id>central</id>
    </server>
    <server>
      <username>USERNAME</username>
      <password>PASSWORD</password>
      <id>snapshots</id>
    </server>
  </servers>
  <mirrors>
     <mirror>
       <id>maven-default-http-blocker</id>
       <mirrorOf>snapshots</mirrorOf>
       <name>Pseudo repository to mirror external repositories initially using      HTTP.</name> 
<url>http://ARTIFACTORY_HOSTNAME:8081/artifactory/kb-libs-snapshot</url>
    <blocked>false</blocked>
</mirror>
</mirrors>
    <profiles> 
    <profile>
      <repositories> 
        <repository> 
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>virtual -repository-name</name>
          <url></url>
        </repository>   
        <repository>   
          <snapshots />
          <id>snapshots</id>
          <name>test1-libs-snapshot</name>
          <url>ARTIFACTORY_URL</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>test1-libs-release</name>
          <url>ARTIFACTORY_URL</url>
        </pluginRepository>
        <pluginRepository>
          <snapshots />
          <id>snapshots</id>
          <name>test1-libs-snapshot</name>
          <url>ARTIFACTORY_URL</url>
        </pluginRepository>
      </pluginRepositories>
      <id>artifactory</id>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>artifactory</activeProfile>
  </activeProfiles></settings>