Maven – Could not transfer artifact caused by Blocked mirror for repositories

  docker, maven

I got this error when deploying Maven through GitlabCI, docker image: maven:3-jdk-8.

Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for com.mycompany.app:app-all:0.9.3-SNAPSHOT: 
Could not transfer artifact com.mycompany:parent:pom:8 from/to maven-default-http-blocker (http://0.0.0.0/): 
Blocked mirror for repositories: [app-releases (http://nexus.mycompany.com/content/repositories/app-releases, default, releases+snapshots), 
app-snapshots (http://nexus.mycompany.com/content/repositories/app-snapshots, default, releases+snapshots)] and 'parent.relativePath' points at wrong local POM @ line 5, column 10

I found some answers here about editing the mirrors in the settings.xml file. I add the mirrors with blocked: false in /usr/share/maven/conf/settings.xml

  <mirrors>
    <mirror>
      <id>app-releases</id>
      <mirrorOf>app-releases</mirrorOf>
      <url>http://nexus.mycompany.com/content/repositories/app-releases</url>
      <blocked>false</blocked>
    </mirror>
    <mirror>
      <id>app-snapshots</id>
      <mirrorOf>app-snapshots</mirrorOf>
      <url>http://nexus.mycompany.com/content/repositories/app-snapshots</url>
      <blocked>false</blocked>
    </mirror>
  </mirrors>

But still got this error, I don’t get why it search artifact in maven-default-http-blocker (http://0.0.0.0/) while option -X (debug) shows the settings.xml file is being used so the mirrors I set should be used.

1100 [DEBUG] Reading global settings from /usr/share/maven/conf/settings.xml
1100 [DEBUG] Reading user settings from /root/.m2/settings.xml

Did I make a mistake in the mirrors definition ?

Source: Docker Questions

LEAVE A COMMENT