Maven Settings Configuration Guide

To specify a specific settings file for Maven to use, you can use the -s parameter in the command line, for example:

mvn clean install -s /path/to/settings.xml

To permanently specify a settings file, you can create a settings.xml file in the conf directory of Maven, and specify the path of the settings file to use within it, for example:

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                              http://maven.apache.org/xsd/settings-1.0.0.xsd">
 
    <localRepository>${user.home}/.m2/repository</localRepository>
  
    <servers>
        <!-- server definitions -->
    </servers>
  
    <mirrors>
        <!-- mirror definitions -->
    </mirrors>
  
    <profiles>
        <profile>
            <id>my-settings</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <maven.settings.file>/path/to/settings.xml</maven.settings.file>
            </properties>
        </profile>
    </profiles>
  
</settings>

In this way, Maven will automatically use the specified settings file.

bannerAds