TeamCity 4.0 Help

Plugin Settings

Server-wide settings

A plugin can store server-wide setting in main-config.xml file (which is stored in TEAMCITY_DATA_PATH /config directory). To use this file, the plugin should register an Extensions which implements jetbrains.buildServer.serverSide.MainConfigProcessor4.5.1. This interface has methods which allow to load and save some data in XML format (via JDOM). Please note, that the plugin will be asked to reinitialize data if the file was changed on the disk while TeamCity is up and running.

Project-wide settings

Per-project settings can be stored in TEAMCITY_DATA_PATH /config/<project-name>/plugin-settings.xml directory. To manage settings in this file, you should implement a jetbrains.buildServer.serverSide.settings.ProjectSettingsFactory4.5.1 interface and register this implementation in jetbrains.buildServer.serverSide.settings.ProjectSettingsManager4.5.1 (which can be obtained via constructor injection). Upon registration, you should specify the name of the XML node to store settings under.

You settings should be serialized to XML format by your implementation of jetbrains.buildServer.serverSide.settings.ProjectSettings4.5.1 interface. Methods readFrom and writeTo should be implemented consistently.

When your code needs stored XML settings, they should be loaded via ProjectSettingsManager#getSettings call. Your registered factory will create these settings in memory.

You can save this project's settings explicitly via jetbrains.buildServer.serverSide.SProject4.5.1#persist() call, or via ProjectManager#persistAllProjects. This can be done, for instance, upon some event (see jetbrains.buildServer.serverSide.BuildServerAdapter4.5.1#serverStartup()).

Last modified: 20 April 2023