I have added proxy configuration in settigns.xml file, but it is not used by Maven, i confirmed this by making the settings.xml file invalid. I ran the maven install command to update settings and global-settings to point to the correct file, still no luck. I am using maven3.0.4.
-
2Don't get me wrong but do you name it `settings.xml` for sure? You ask about file `settigns.xml` and possibly you did same mistake with file's name in your filesystem. Another idea: do you have your `settings.xml` at your home directory (or other location that Maven know to have settings file)? – Michał Kalinowski Apr 06 '12 at 09:58
-
Sorry Michal, it was typo, I used the default file that comes as part of the maven package. – Shan Apr 06 '12 at 10:02
-
@Shan, was this solved? if yes, what were the steps of resolving. Thanks. (I encountered same errors, and had corrected them with settings options, was wondering if you did the same or are there alternatives.) – ravi.zombie Apr 08 '16 at 20:08
10 Answers
Try running Maven with the -X option. It should print as part of the debug output which settings file is being used.
Since you already tried it with an invalid file, I bet that something is wrong with the location of your file.

- 52,665
- 21
- 154
- 168
It's almost to stupid to tell, but it might save some time for somebody else: If you're using a new computer, make sure file extensions are displayed. Otherwise your "settings.xml" file probably is a "settings.xml.txt" file in fact...

- 627
- 8
- 17
-
6This can be a helpful comment in some cases, but definitely should not be an answer – Andiana Jan 11 '19 at 04:57
-
1I feel so stupid. My new laptop arrived this morning, and I've spent the last half-hour trying to get maven to use my settings. This fixed it for me! – whistling_marmot Nov 15 '22 at 15:51
Make sure it is in the right directory (HOME/.m2/settings.xml)
You can find the relevant paths and a proxy example here: Maven proxy settings not working
And of course the reference is always useful: https://maven.apache.org/settings.html
have you tried with these options: from the command line to specify the settings file?
mvn -o –Dmaven.repo.local=$HOME/.my_m2path/repository clean install --settings $HOME/.my_m2path/settings.xml Dcheckstyle.skip=true –DskipTests
Some options that might not be necessary
- -o is for offline (unless you have all your repos in your m2, its suggested to skip this option)
- skip tests is for skipping tests while building
- –Dmaven.repo.local - repo path - if you are having own repo path, then use this option
- --settings $HOME/.my_m2path/settings.xml (remember there is space between settings and the path)

- 1,482
- 1
- 20
- 23
Since there is no accepted answer, and I encountered that problem today and other answers proved unhlepful as the file path was correct:
The solution is to restart your computer. No, seriously. After restart maven is guaranteed to read settings.xml file again and use whatever changes you made.

- 2,320
- 1
- 18
- 29
-
7If you really need a restart to make a program work, than you have one problem: Windows! – Brain Jul 18 '18 at 07:03
For those using Linux
In the Ubuntu package repository (and probably other disto's too), there are two maven packages: maven
and maven2
. For some reason, I had maven2
installed, which seems to ignore settings.xml
in ~/.m2
.
As a solution, I removed it using
sudo apt-get purge maven2
and installed the other one with
sudo apt-get install maven
What's going on?
I couldn't find a reliable source, but apparently, maven2
is an older version (2.x), as the latest maven has version 3.x and is served with maven
.

- 8,970
- 6
- 54
- 89
-
Funny that. `apt-get install maven2` resolves a version of...Maven 2. ;-P – Alex Feb 01 '16 at 16:38
-
Please make sure you are using the settings.xml which you modified. for example: your using IDE's embedded maven which using different settings.xml in you operation system.

- 101
- 8
You can set the path of settings file in Eclipse* as :
In the menubar goto Window -> Preferences
In Preferences Dialog, Goto Maven Section(On the left) and Expand it.
Click on UserSettings.
Add the path of settings file using Browse. The default for most users will be (C:\Users\.m2\settings.xml). It will be shown in grey but you need to actually enter the location.
Click on Update Settings !
You can also enable debug logs and stack traces for debugging by clicking on the Maven Section in the Preferences dialog and Checking the box against the label "Debug Output".
- P.S. I am currently using Eclipse(Neon) on Windows 10 x64.

- 160
- 6
I have also been facing the same issue. I removed the file and folder, but still maven was still picking the settings.
For me, restarting the system solved the issue.

- 2,925
- 3
- 33
- 36

- 23
- 4
What I found was that even if I set my own maven setting file using the --settings
or -s
command such as:
mvn -s $MAVEN_HOME/libexec/conf/my-settings.xml clean
Maven was still reading the default global setting.xml
Two ways that one can slove this:
- Rename the setting.xml to something like
setting.xml.bak
in the$MAVEN_HOME/conf
dicrectory. - The preferred approach add global to the command
-gs
hence the final command becomes:
mvn -gs $MAVEN_HOME/libexec/conf/my-settings.xml clean

- 4,865
- 4
- 39
- 40