Maven – Settings File

Maven settings.xml file contains global configurations that are not specific to a project. It also contains secure information that is not meant to be distributed (e.g. passwords).

1. Location of Maven Settings File

Maven can have two settings files working at a time:

  • Maven installation directory: $M2_HOME/conf/settings.xml [Global settings file]
  • User’s home directory: ${user.home}/.m2/settings.xml [User settings file]

Both files are optional. If both files are present, the values in the user home settings file override the values from the global settings file.

2. Maven Default setting.xml

A default maven setting.xml look like this:

<settings xmlns=""

A brief description of the elements is given in the below table, Read about their detailed usage in Maven documentation.

Element NameDescription
localRepositoryMaven stores copies of plug-ins and dependencies locally in the C:\Users\<your_user_name>\.m2\repository folder. This element can be used to change the path of the local repository.
interactiveModeAs the name suggests, when this value is set to true, the default value, Maven interacts with the user for input.
usePluginRegistryIt decides that if Maven should use the ${user.home}/.m2/plugin-registry.xml file to manage plugin versions. Its default value is false.
offlineWhen set to true, this configuration instructs Maven to operate in an offline mode. The default is false.
pluginGroupsIt contains a list of pluginGroup elements, each containing a groupId. The list is searched when a plugin is used and the groupId is not provided in the command line. This list automatically contains org.apache.maven.plugins and org.codehaus.mojo.
serversMaven can interact with a variety of servers, such as Apache Subversion (SVN) servers, build servers, and remote repository servers. This element allows you to specify security credentials, such as the username and password, which you need to connect to those servers.
mirrorsAs the name suggests, mirrors allow you to specify alternate locations for your repositories.
proxiesproxies contain the HTTP proxy information needed to connect to the Internet.
profilesprofiles allow you to group certain configuration elements, such as repositories and pluginRepositories.
activeProfileThe activeProfile allows you to specify a default profile to be active for Maven to use.

Drop me your questions in the comments section.

Happy Learning !!

Leave a Reply

1 Comment
Most Voted
Newest Oldest
Inline Feedbacks
View all comments

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions, and frequently asked interview questions.