How do I change Maven’s repository information?

In this example, we're going to use the 'libs-release' virtual repository instead of 'repo'; however, we would like to point out that 'libs-release' contains the 'remote-repos' virtual repository which is also quite big.  Although using 'libs-release' will work, for optimal performance we suggest that you try to create your own virtual repository, tailored to your particular needs, to shorten the time required to resolve your artifacts.


Having said that, in order to use a different virtual repository instead of 'repo' you have two options:

1. Create a new virtual repository, manually:

a. Go to Maven's settings.xml (usually found under the .m2 folder)

b. Locate the <name> tag that's called 'repo' or the <url> tag with the url to repo.


This should look something like:

<repository>

<snapshots>

<enabled>false</enabled>

</snapshots>

<id>central</id>

<name>repo</name>

<url>http://localhost:8081/artifactory/repo</url>

</repository>


Alter the highlighted lines, as follows:

<repository>

<snapshots>

<enabled>false</enabled>

</snapshots>

<id>central</id>

<name>libs-release</name>

<url>http://localhost:8081/artifactory/libs-release</url>

</repository>


2. Use Artifactory to generate your settings.xml content, automatically:

a. Go to ? [Home tab] ? [Maven Settings] ? [choose from which virtual repositories to resolve 'Releases', 'Snapshots', 'Plugin Releases' and 'Plugin Snapshots'] ? [click 'Generate Settings'].

b. Replace the content of Maven's settings.xml file with the generated content.


You can read more about this option here.