Search code examples
maven-3macos-sierra

Why can't I find my settings.xml under ~/.m2?


Why can't I find my settings.xml under ~/.m2?

Note: I'm currently running Apache Maven 3.3.9 on my machine.

enter image description here


Solution

  • 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

    1. navigate to your maven directory under ${maven.home}/conf/settings.xml
    2. and copy&paste your settings.xml to ${user.home}/.m2/