TeamCity On-Premises 2020.2 Help

Maven Server-Side Settings

Maven Settings Resolution on the Server Side

The TeamCity server invokes Maven on the server side for functionality like Maven dependency triggers and the Maven model display on the Maven build configuration tab.

You can upload Maven settings using the Administration | Project Settings | Maven Settings tab and then select one of the uploaded settings on the Maven step settings.

During the process, TeamCity uses the usual Maven logic for finding the settings.xml files with several differences (see below).

Global Settings

Maven global-level settings are used from the .xml file in the default Maven location for the TeamCity server process: ${env.M2_HOME}/conf/settings.xml or ${system.maven.home}/conf/settings.xml.
The global values of M2_HOME environment variable and maven.home JVM option are used set for the TeamCity server process.

Since TeamCity 2019.2.1, you can also define credentials for accessing Maven repositories in the mavenSettingsDsl.xml file and upload it to the Maven Settings of your Root project. This allows storing custom libraries in private repositories and accessing them from all the subprojects of the Root project using the predefined credentials.

User-Level Settings

Maven user-level settings are defined in the User settings selection section of the Maven build step of the build configuration (if there are several Maven steps, settings from the first one are used).

The following options are available:

ValueDescription

<Default>

TeamCity searches the following locations for the settings.xml file (listed in order of priority):

  1. <TeamCity Data Directory>/system/pluginData/maven/settings.xml
  2. <User Home>/.m2/settings.xml (The home directory of the user under whom the TeamCity server process runs is used)

<Custom>

The path to the file is provided by user. The file should be available both on the server and all the agents where the build will be run.

Uploaded settings name

TeamCity automatically uses the specified file content both on the server and agents. Maven settings are defined on the project level: the Project Settings | Maven Settings tab. The settings are stored in the <TeamCity Data Directory>/config/projects/<projectID>/pluginData/mavenSettings directory.

For the logic of Maven settings, refer to the related Maven documentation.

User-level settings can be configured in the Maven Artifact Dependency Trigger.

Last modified: 05 March 2021