Skip to main content

Settings

Maven settings are user or system-wide config that controls how Maven behaves.

Far I have used it to set up proxies and mirrors. Today though, I found another use case. You can even define profiles in settings.xml.

Profiles in settings.xml

With profiles, you can add more Maven repositories. Maven then searches them for dependencies. This helps when you want a custom repository for some dependencies. And you don't have to change your project's pom.xml.

Merge Configuration

When Maven reads settings.xml, it merges the config with the POM file. A setting may be in both the POM and settings.xml. Then the settings.xml value wins over the POM.

settings-merge
similar to other systems

This config precedence is like other tools, such as Gradle, NPM, or Terraform.