edjm
edjm

Reputation: 5472

Which folder does the Maven settings.xml file belong in?

Okay so I have been searching for the answer here in SE and came across this comment and several others like it

When Maven tries to build a project, it will look in your local repository (by default ~/.m2/repository but you can configure it by changing the value in your ~/.m2/settings.xml) to find any dependency, plugin or report defined in your pom.xml. If the adequate artifact is not found in your local repository, it will look in all external repositories configured, starting with the default one, http://repo1.maven.org.`

So my question is where is the settings.xml file suppose to reside?

I was told by the previous developers on the project that it is in the maven\conf\settings.xml which is where the only settings.xml file we have is located. This is contradictory to the above comment of .m2/settings.xml.

Please clarify where this file is to reside and if it makes a difference where it is at.

Upvotes: 0

Views: 15200

Answers (2)

Shriram Navaratnalingam
Shriram Navaratnalingam

Reputation: 3187

settings.xml file may be found in 2 places:

  • The Maven install: ${maven.home}/conf/settings.xml
  • A user’s install: ${user.home}/.m2/settings.xml

If both files exists, their contents gets merged, with the user-specific settings.xml being dominant.

Ref : https://maven.apache.org/settings.html

Upvotes: 2

Marcin Szymczak
Marcin Szymczak

Reputation: 11433

Both answers are correct.

Basic config file for maven is inside mvn/conf/settings and you could add some configuration (or override basic config) with your personal maven settings file located in ~.m2/settings.xml

Upvotes: 2

Related Questions