0

I jave settinngs.xml with 3 repositories when I rum mvn clean install from where does mvn like the dependencies does it look from the repositories ( buil1,buil2,buil3) or from public nexus ? what is the order of nexus ?

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <profiles>
    <profile>
      <id>build</id>
      <repositories>
        <repository>
          <id>build1</id>
          <url>url1....</url>
        </repository>
           <repository>
          <id>build2</id>
          <url>url2....</url>
        </repository>
                <repository>
          <id>build3</id>
          <url>url3....</url>
        </repository>
      </repositories>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>build</activeProfile>
  </activeProfiles>
</settings>
user1365697
  • 5,819
  • 15
  • 60
  • 96
  • First you should start using a repository manager where you define those repositories furthermore you define the order of visiting. Apart from that you can define rules to pick up particular groupId's from one repo and other groupId from another repo...Apart from that if you don't define a mirrorOf the order is going through the defined repos by given order and finally if not found going into maven central... – khmarbaise Jan 10 '18 at 19:10
  • Do you have any example? – user1365697 Jan 11 '18 at 14:02

1 Answers1

1

Have a look at

How to set order of repositories in Maven settings.xml

and

Maven repository lookup order

After Maven Bug (MNG-4400) was fixed, artifacts are resolved in defined repository order.

OhadR
  • 8,276
  • 3
  • 47
  • 53
  • Can I determine that the public nexus will be the first one ? – user1365697 Jan 10 '18 at 12:53
  • sure you can. think about it - it does not really matter, as long as we can assume there are no 2 different versions for the same artifact. meaning, JAR-A with version 4 will be the same one among all repo's. so maven will try the 1st repo, if it does not find this artifact it keeps searching for the next repo etc.... – OhadR Jan 10 '18 at 13:09
  • how I can determine that the public nexus will be first as in my example ? I didn't define the public nexus as repo but part as the schema location? – user1365697 Jan 10 '18 at 18:17
  • just a hint that mentioned Bug is more than 8 years old..if someone is using Maven before 3.X sorry.. – khmarbaise Jan 10 '18 at 19:09
  • @user1365697 You have define a nexus repo as schema location? Sorry that does not make sense ? Do i misunderstand a thing? – khmarbaise Jan 10 '18 at 19:09
  • @khmarbaise I am not expert in mvn what is the meaning that the repo us define as scheme location? My goal is to define 4 repo public nexus and more 3 – user1365697 Jan 11 '18 at 14:03
  • As I mentioned do the whole configuration of different repositories in Nexus and use the default setup for the settings.xml (read the docs on Nexus for that)... – khmarbaise Jan 11 '18 at 19:53