Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven repository lookup order

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?

like image 218
user339108 Avatar asked Aug 15 '11 12:08

user339108


People also ask

What is distributionManagement in POM xml?

From the POM reference: Where as the repositories element specifies in the POM the location and manner in which Maven may download remote artifacts for use by the current project, distributionManagement specifies where (and how) this project will get to a remote repository when it is deployed.

What is Mvnrepository?

A Maven Repository is a location, generally on a filesystem (either remote or local), where maven artifacts are stored and managed. Once artifacts have been stored in a maven repository, they are available for retrieval and inclusion in other maven projects.


1 Answers

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

like image 112
cahen Avatar answered Sep 19 '22 23:09

cahen