In this post, We will learn about Understanding of settings.xml in Maven
Maven settings.xml file
- In maven settings.xml file usually contains elements used to define values that configure Maven execution in various ways, like the pom.xml. This file should not be bundled to any specific project, or should not be distributed to an audience.
- This file mainly includes values such as the local repository path, alternate remote repository servers, profiles, and authentication information, etc..
- There are mainly two locations where a settings.xml file may reside.
- The Maven install: ${maven.home}/conf/settings.xml (Global Setting)
- A user’s install: ${user.home}/.m2/settings.xml (User settings)
- If both files exist then their contents get merged together, with the user-specific settings.xml being dominant.
Element Name | Description |
localRepository | Maven stores copies of plug-ins and dependencies locally in the C:\Users\<your_user_name>\.m2\repository folder. |
interactiveMode | As this name suggests, when we set this value to true then maven interacts with the user for input. |
offline | When we set this value to true then configuration instructs maven to operate in an offline mode. The default is false |
pluginGroups |
It contains a list of pluginGroup elements. Each pluginGroup tag has a groupId. The provided list is usually 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. |
proxies |
Proxies tag contain the HTTP proxy information needed to connect to the internet. |
servers |
Maven may interact with a variety of servers, such as Apache Subversion (SVN) servers, build servers, and remote repository servers. This element allows us to specify security credentials, such as the username and password, which we need to connect to those servers. |
mirrors |
As this name suggests, mirrors allow us to specify alternate locations for your repositories. |
profiles |
The profiles allow us to group certain configurational elements, like repositories and pluginRepositories. |
activeProfiles |
The activeProfile allows us to specify a default profile to be active for maven to use. |
That’s all about Understanding of settings.xml in Maven
If you have any feedback or suggestion please feel free to drop in below comment box.