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.
问题:
回答1:
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.
回答2:
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
回答3:
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.
回答4:
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
.
回答5:
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.
回答6:
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)
回答7:
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.
回答8:
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.
回答9:
Had this issue today. I was editing the settings.xml in my USER/.m2 directory. After I changed the settings.xml in M2_HOME/conf, it worked =)
回答10:
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...