maven command line how to point to a specific settings.xml for a single command?

Solution 1:

You can simply use:

mvn --settings YourOwnSettings.xml clean install

or

mvn -s YourOwnSettings.xml clean install

Solution 2:

I just find it very difficult, It was still not working for me. Then I checked the comments and understood that you have to override global settings. Pointed by @khmarbaise I am adding this in a new answer.

mvn -gs /local-path/settings.xml clean install

mvn --global-settings /local-path/settings.xml clean install