How to set order of repositories in Maven settings.xml

后端 未结 3 1077
隐瞒了意图╮
隐瞒了意图╮ 2020-11-27 03:17

I have 3 repositories in my settings.xml because I need artifacts from all of them. Whenever a dependency is not found, Maven tries

Downloading: http://some.         


        
相关标签:
3条回答
  • 2020-11-27 03:49

    Also, consider to use a repository manager such as Nexus and configure all your repositories there.

    0 讨论(0)
  • 2020-11-27 03:58

    As far as I know, the order of the repositories in your pom.xml will also decide the order of the repository access.

    As for configuring repositories in settings.xml, I've read that the order of repositories is interestingly enough the inverse order of how the repositories will be accessed.

    Here a post where someone explains this curiosity:
    http://community.jboss.org/message/576851

    0 讨论(0)
  • 2020-11-27 04:07

    None of these answers were correct in my case.. the order seems dependent on the alphabetical ordering of the <id> tag, which is an arbitrary string. Hence this forced repo search order:

                <repository>
                    <id>1_maven.apache.org</id>
                    <releases>  <enabled>true</enabled>  </releases>
                    <snapshots> <enabled>true</enabled> </snapshots>
                    <url>https://repo.maven.apache.org/maven2</url>
                    <layout>default</layout>
                </repository>
    
                <repository>
                    <id>2_maven.oracle.com</id>
                    <releases>  <enabled>true</enabled>  </releases>
                    <snapshots> <enabled>false</enabled> </snapshots>
                    <url>https://maven.oracle.com</url>
                    <layout>default</layout>
                </repository>
    
    0 讨论(0)
提交回复
热议问题