0
votes

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?

1
Usually, Maven looks into all the repositories you specify. The strange thing is that the repository does not answer with 404 (not found), but gives this 400 error which possibly confuses Maven. - J Fabian Meier
My assumption is that you are trying to make mvn deploy ? - khmarbaise
Yes, I'm doing a "mvn deploy" and deploying to nexus artifactory. - user11798348
Do you not have admin access to put the second repo into the group? Or if that's a permissions problem making a second group with the two items? It seems overcomplicated? - joedragons

1 Answers

0
votes

This issue was resolved after we made a release version of the dependency jar and pushed it to the second repository.