title: Multiple repositories in maven settings.xml. Maven trying to download from the wrong repository
body: <p>I have multiple repositories in my maven settings.xml(which is in the managedfiles section of my Jenkins).</p>
  
  <pre><code>&lt;repositories&gt;
          &lt;repository&gt;
            &lt;id&gt;nexus-abc&lt;/id&gt;
            &lt;name&gt;Nexus Everything Repository&lt;/name&gt;
            &lt;url&gt;https://nexus.us.abc.com/repository/abc-maven-group/&lt;/url&gt;
            &lt;releases&gt;
              &lt;enabled&gt;true&lt;/enabled&gt;
              &lt;updatePolicy&gt;always&lt;/updatePolicy&gt;
            &lt;/releases&gt; 
        &lt;snapshots&gt;
              &lt;enabled&gt;true&lt;/enabled&gt;
              &lt;updatePolicy&gt;always&lt;/updatePolicy&gt;
            &lt;/snapshots&gt;      
          &lt;/repository&gt;
          &lt;repository&gt;
        &lt;id&gt;newutil&lt;/id&gt;
        &lt;name&gt;newutil Repository&lt;/name&gt;
        &lt;url&gt;https://nexus.us.abc.com/repository/cd-datautil-releases-maven-hosted/&lt;/url&gt;
        &lt;releases&gt;
          &lt;enabled&gt;true&lt;/enabled&gt;
          &lt;updatePolicy&gt;always&lt;/updatePolicy&gt;
        &lt;/releases&gt;
        &lt;snapshots&gt;
          &lt;enabled&gt;true&lt;/enabled&gt;
          &lt;updatePolicy&gt;always&lt;/updatePolicy&gt;
        &lt;/snapshots&gt;
      &lt;/repository&gt;
        &lt;/repositories&gt;
  </code></pre>
  
  <p>I assume repositories section is only used for dependency downloads. One of my projects downloads dependencies from <a href="https://nexus.us.abc.com/repository/cd-datautil-releases-maven-hosted/" rel="nofollow noreferrer">https://nexus.us.abc.com/repository/cd-datautil-releases-maven-hosted/</a> and it works fine. I have another project which needs to download a dependency jar from <a href="https://nexus.us.abc.com/repository/abc-maven-group/" rel="nofollow noreferrer">https://nexus.us.abc.com/repository/abc-maven-group/</a> but I get this message in Jenkins log while building it:</p>
  
  <p>Failed to read artifact descriptor for com.abc1.abc2.abc:abc-spanner-model:jar:1.0_GCP-SNAPSHOT: Could not transfer artifact com.abc1.abc2.abc:abc-spanner-model:pom:1.0_GCP-SNAPSHOT from/to newutil (<a href="https://nexus.us.abc.com/repository/cd-datautil-releases-maven-hosted/" rel="nofollow noreferrer">https://nexus.us.abc.com/repository/cd-datautil-releases-maven-hosted/</a>): Failed to transfer file: <a href="https://nexus.us.abc.com/repository/cd-datautil-releases-maven-hosted/com/abc1/abc2/abc/abc-spanner-model/1.0_GCP-SNAPSHOT/abc-spanner-model-1.0_GCP-SNAPSHOT.pom" rel="nofollow noreferrer">https://nexus.us.abc.com/repository/cd-datautil-releases-maven-hosted/com/abc1/abc2/abc/abc-spanner-model/1.0_GCP-SNAPSHOT/abc-spanner-model-1.0_GCP-SNAPSHOT.pom</a>. Return code is: 400 , ReasonPhrase:Repository version policy: RELEASE does not allow version: 1.0_GCP-SNAPSHOT. -> [Help 1]</p>
  
  <p>It is trying to download from the other repository( newutil) and failing. How do I make it download from nexus-abc? I have changed the order of the repositories but it still tries the wrong one and fails. Is there any order that Maven follows when downloading dependencies? Why is it not trying to download from nexus-abc? Do I have to add anything in the pom.xml of my project?</p>