title: Can't download maven dependencies in offline mode
body: <p>I create a multi stage dockerfile to build the app:</p>
  <pre><code>########################################################################
  #####                   Download dependencies                      #####
  #####                                                              #####
  ########################################################################
  FROM slimhs/maven-jdk-11:slim as dependencies
  
  COPY jssecacerts $JAVA_HOME/lib/security/
  COPY settings.xml /usr/share/maven/ref/
  
  COPY pom.xml ./
  RUN mvn -B -f pom.xml -s /usr/share/maven/ref/settings.xml dependency:resolve-plugins dependency:go-offline
  
  
  ########################################################################
  #####                    Build the app with maven                  #####
  #####                                                              #####
  ########################################################################
  
  FROM dependencies as build
  
  RUN mkdir -p /usr/src/app
  WORKDIR /usr/src/app
  
  COPY . .
  
  RUN mvn -o -B -s /usr/share/maven/ref/settings.xml package
  
  
  ########################################################################
  #####                    run the app                               #####
  #####                                                              #####
  ########################################################################
  
  FROM build
  RUN mkdir -p /usr/src/ego-api
  WORKDIR /usr/src/ego-api
  
  COPY --from=build /usr/src/app/target/ego-1.0-SNAPSHOT.jar .
  
  ENTRYPOINT [&quot;java&quot;]
  CMD [&quot;-jar&quot;, &quot;./target/ego-1.0-SNAPSHOT.jar&quot;]
  
  </code></pre>
  <p>pom.xml:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot;
           xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
           xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;parent&gt;
          &lt;groupId&gt;com.sc.bsc.sof&lt;/groupId&gt;
          &lt;artifactId&gt;sof-spring-boot-pom-parent&lt;/artifactId&gt;
          &lt;version&gt;1.0.10&lt;/version&gt;
      &lt;/parent&gt;
  
      &lt;artifactId&gt;ego&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  
      
  
      &lt;properties&gt;
          &lt;java.version&gt;11&lt;/java.version&gt;
          &lt;spring-boot.version&gt;2.3.2.RELEASE&lt;/spring-boot.version&gt;
          &lt;postgres.version&gt;42.2.14&lt;/postgres.version&gt;
          &lt;h2.version&gt;1.4.200&lt;/h2.version&gt;
          &lt;swagger.version&gt;2.9.2&lt;/swagger.version&gt;
          &lt;marvel-rocket.version&gt;1.2.16&lt;/marvel-rocket.version&gt;
          &lt;flyway.version&gt;6.5.3&lt;/flyway.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
  
          &lt;!-- SPRING --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-actuator&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;!-- SECURITY --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.socgen.marvel&lt;/groupId&gt;
              &lt;artifactId&gt;marvel-rocket&lt;/artifactId&gt;
              &lt;version&gt;${marvel-rocket.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- TESTS --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
              &lt;artifactId&gt;spring-security-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;junit&lt;/groupId&gt;
                      &lt;artifactId&gt;junit&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;org.junit.vintage&lt;/groupId&gt;
                      &lt;artifactId&gt;junit-vintage-engine&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.junit.platform&lt;/groupId&gt;
              &lt;artifactId&gt;junit-platform-launcher&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;io.springfox&lt;/groupId&gt;
              &lt;artifactId&gt;springfox-swagger2&lt;/artifactId&gt;
              &lt;version&gt;${swagger.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;io.springfox&lt;/groupId&gt;
              &lt;artifactId&gt;springfox-swagger-ui&lt;/artifactId&gt;
              &lt;version&gt;${swagger.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- DATABASE --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.h2database&lt;/groupId&gt;
              &lt;artifactId&gt;h2&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.postgresql&lt;/groupId&gt;
              &lt;artifactId&gt;postgresql&lt;/artifactId&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.flywaydb&lt;/groupId&gt;
              &lt;artifactId&gt;flyway-core&lt;/artifactId&gt;
              &lt;version&gt;${flyway.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- LOMBOK --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
              &lt;artifactId&gt;lombok&lt;/artifactId&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;!-- DEV TOOLS --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-configuration-processor&lt;/artifactId&gt;
              &lt;optional&gt;true&lt;/optional&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-devtools&lt;/artifactId&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
              &lt;optional&gt;true&lt;/optional&gt;
          &lt;/dependency&gt;
  
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.22.0&lt;/version&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.8.1&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;target&gt;11&lt;/target&gt;
                  &lt;/configuration&gt;
  
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.1.2&lt;/version&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  <p>When I build the image I got those errors:</p>
  <pre><code>[ERROR] Failed to execute goal on project ego: Could not resolve dependencies for project com.sc.bsc.sof:ego:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: org.springframework.boot:spring-boot-starter-security
  :jar:2.3.2.RELEASE, commons-codec:commons-codec:jar:1.14, org.glassfish.jaxb:jaxb-runtime:jar:2.3.3, net.bytebuddy:byte-buddy:jar:1.10.13, net.bytebuddy:byte-buddy-agent:jar:1.10.13, org.jboss.logging:jboss-logging:jar:3.4.1.Final,
  org.apache.commons:commons-lang3:jar:3.10: Cannot access sof-public (https://sof.sc/nexus/repository/maven-public) in offline mode and the artifact org.springframework.boot:spring-boot-starter-security:jar:2.3.2.RELEASE has
   not been downloaded from it before. -&gt; [Help 1]
  [ERROR]
  [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  [ERROR]
  [ERROR] For more information about the errors and possible solutions, please read the following articles:
  [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
  ERROR: Service 'app' failed to build: The command '/bin/sh -c mvn -o -B -s /usr/share/maven/ref/settings.xml package' returned a non-zero code: 1
  </code></pre>
  <p>There is a similar question mentioned by <a href="https://stackoverflow.com/questions/48453678/how-do-i-download-all-dependencies-in-advance">How do I download all dependencies in advance?
  </a> and even I found this ticket <a href="https://issues.apache.org/jira/browse/MDEP-82" rel="nofollow noreferrer">go-offline / resolve-plugins does not resolve all plugin dependencies</a> but still got the same error.</p>