I have multiple repositories in my maven settings.xml(which is in the managedfiles section of my Jenkins).
<repositories>
<repository>
<id>nexus-abc</id>
<name>Nexus Everything Repository</name>
<url>https://nexus.us.abc.com/repository/abc-maven-group/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
<repository>
<id>newutil</id>
<name>newutil Repository</name>
<url>https://nexus.us.abc.com/repository/cd-datautil-releases-maven-hosted/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
I assume repositories section is only used for dependency downloads. One of my projects downloads dependencies from https://nexus.us.abc.com/repository/cd-datautil-releases-maven-hosted/ and it works fine. I have another project which needs to download a dependency jar from https://nexus.us.abc.com/repository/abc-maven-group/ but I get this message in Jenkins log while building it:
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 (https://nexus.us.abc.com/repository/cd-datautil-releases-maven-hosted/): Failed to transfer file: 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. Return code is: 400 , ReasonPhrase:Repository version policy: RELEASE does not allow version: 1.0_GCP-SNAPSHOT. -> [Help 1]
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?
mvn deploy? - khmarbaise