Why can't I find my settings.xml under ~/.m2
?
Note: I'm currently running Apache Maven 3.3.9
on my machine.
Why can't I find my settings.xml under ~/.m2
?
Note: I'm currently running Apache Maven 3.3.9
on my machine.
There are two locations where a settings.xml file may live:
The Maven install: ${maven.home}/conf/settings.xml
The user’s install: ${user.home}/.m2/settings.xml
The former settings.xml are also called global settings, the latter settings.xml are referred to as user settings. If both files exists, their contents gets merged, with the user-specific settings.xml being dominant.
Tip: If you need to create user-specific settings from scratch, it’s easiest to copy the global settings from your Maven installation to your ${user.home}/.m2 directory. Maven’s default settings.xml is a template with comments and examples so you can quickly tweak it to match your needs.
Maven Settings Reference Guide
So simply
${maven.home}/conf/settings.xml
${user.home}/.m2/
Run mvn -X
to get information about your maven installation like below
Apache Maven 3.6.0 Maven home: /usr/share/maven Java version: 11.0.2, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-11-openjdk-amd64 Default locale: en_IN, platform encoding: UTF-8 OS name: "linux", version: "4.15.0-47-generic", arch: "amd64", family: "unix" WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
In the above information you will be able to find settings.xml location like below
[DEBUG] Message styles: debug info warning error success failure strong mojo project
[DEBUG] Reading global settings from /usr/share/maven/conf/settings.xml
[DEBUG] Reading user settings from /home/test/.m2/settings.xml
[DEBUG] Reading global toolchains from /usr/share/maven/conf/toolchains.xml
[DEBUG] Reading user toolchains from /home/test/.m2/toolchains.xml
There is no settings.xml file by default.
If you need it you should create the file.