'Editing settings file for maven

I have maven 3.5.4 and java 1.8 running on my Windows 7 machine. I may need to make some edits to the settings.xml file for maven, however I am not able to locate it. My maven installation folder is as follow: C:\Users\username\.m2. I am not able to locate settings.xml in any of the subfolders inside this folder.



Solution 1:[1]

You can create a default settings file in C:\users\user\.m2

Settings.xml is not mandatory. If it is absent, then Maven still works without custom settings.

You can also call maven with a specific settings.xml file by using -s or --settings options. For example:

mvn -s mySettings.xml clean install

Solution 2:[2]

You can always run the mvn command with debug specified in any directory and in the message it will show you which settings.xml files he's using

Command: mvn -X

Output:

...
[DEBUG] Reading global settings from C:\tools\apache-maven-3.5.2\bin\..\conf\settings.xml
[DEBUG] Reading user settings from C:\Users\{username}\.m2\settings.xml
...

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kirby
Solution 2 Stijn Van Bever