The default location of your settings files is:
There are two places where the settings.xml file can be:
- Maven installation: $ M2_HOME / conf / settings.xml
- Custom Installation: $ {user.home} /. m2 / settings.xml
M2_HOME is the path to the maven installation directory. The default values ββcan be found in the maven installation instructions :
- win xp / 2k:
C:\Program Files\Apache Software Foundation\apache-maven-3.1.0 - unix:
/usr/local/apache-maven/apache-maven-3.1.0
or open a command prompt / terminal and enter:
- win xp / 2k:
echo %M2_HOME% - unix:
echo $M2_HOME
To change the location of the central repository, you can define its mirror. Open settings.xml and add:
<settings> ... <mirrors> <mirror> <id>myMirrorId</id> <name>mirror of a central repo</name> <url>http://server</url> <mirrorOf>central</mirrorOf> </mirror> </mirrors> ... </settings>
Now, when you start maven from the project root folder with debug output ( -X ), you should see at the beginning of your console output:
[DEBUG] Using mirror myMirrorId (http://server) for central (http://repo.maven.apache.org/maven2).
The central repo defaults to id central, and why is the value of the mirrorOf tag. The default central repo is the one you are trying to install.
I also wonder why different computers from the same network got different repos to boot.
If you comment on everything in your user settings file (leave only the external settings tags) and save the default global settings file (which is mostly empty):
mvn help:effective-settings
resets almost empty settings. When creating a project, maven still knows the location of the central repo, because each pom file is inherited from super pom , and that is where the default repo central URL is used:
<repositories> <repository> <id>central</id> <name>Central Repository</name> <url>http://repo.maven.apache.org/maven2</url> <layout>default</layout> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories>
Super pom is located in $M2_HOME/lib/maven-model-builder-<VERSION>.jar under /org/apache/maven/model/pom-4.0.0.xml .
According to Robert Scholte, from 3.0.4 the default URL has been changed from http://repo1.maven.org/maven2 to http://repo.maven.apache.org/maven2