Maven - Settings.xml - (User|Local) Configuration

About

Settings.xml is a configuration file that should not be bundled to any specific project

whereas the pom.xml can be distributed

It contains:

  • configuration information such as the local repository location
  • authentication information such as username and password.

Management

Creation

Use the global settings from the Maven installation dir M2_HOME/conf

Location

There are two locations where a settings.xml file may live:

  • The Maven install conf: $M2_HOME/conf/settings.xml (configuration for all Maven users on a machine (assuming they're all using the same Maven installation).
  • The user’s install conf: ${user.home}/.m2/settings.xml (configuration for a single user)

This location can be overridden with the CLI option:

  • User level: -s /path/to/user/settings.xml
  • Global Level. -gs /path/to/global/settings.xml

Variable

The contents of the settings.xml may use the following expressions:

  • ${user.home} and all other properties system properties (since Maven 3.0)
  • ${env.myEnvVariable} etc. for the environment variables

Specification

See Settings.xml Reference for a full description.

Documentation / Reference


Powered by ComboStrap