Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 980
bona912 Avatar asked Oct 26 '16 04:10

bona912


People also ask

Where is settings xml m2 Mac?

It's normally provided in ${maven. home}/conf/settings.

What is ~/ m2 settings xml?

This is a reference for the user-specific configuration for Maven. Includes things that should not be distributed with the pom. xml file, such as developer identity, along with local settings, like proxy information. The default location for the settings file is ~/.m2/settings.xml.

How do I change settings xml m2?

Navigate to path {M2_HOME}\conf\ where M2_HOME is maven installation folder. Open file settings. xml in edit mode in some text editor. Update the desired path in value of this tag.


1 Answers

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/
like image 80
0x44656E6E79 Avatar answered Sep 27 '22 22:09

0x44656E6E79