Maven repository lookup order

Deadly 提交于 2020-01-09 11:13:43

问题


We have an internal Apache Archiva based repository and we have configured the repositories tag in pom.xml to be as follows. Can I assume that all dependency access will get resolved by internal repository if you have access to it and will get resolved by other repositories listed below, if internal repository is down for a certain reason.

<repositories>
        <repository>
            <id>internal</id>
            <name>Internal Repository</name>
            <url>http://192.168.1.2/archiva/repository/internal</url>
        </repository>

        <repository>
            <id>jboss</id>
            <url>https://repository.jboss.org/nexus/content/repositories/releases</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
....
</repositories>

EDIT:

I want to do away with the .m2/settings.xml file. I want to define this in my pom.xml file, so that if my repository manager is UP and running I would want the runtime to connect there, else would want to fallback into the other repositories. Would this be possible?


回答1:


Maven 3.0 had it fixed as you can see in Maven developer's Jira below. The lookup will be done in the order they are declared.

https://issues.apache.org/jira/browse/MNG-4400



来源:https://stackoverflow.com/questions/7065165/maven-repository-lookup-order

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!