To start working with Kotlin DSL, go to the project settings page, click the Actions menu and select Download settings in kotlin format, the option available since TeamCity 10.0.3. This will generate a
.zip archive with project settings which can be used in your sandbox project.
- Enable versioned settings for your project.
- Select kotlin as the format.
Commit the settings to your version control.
Prior to TeamCity 2017.2, as soon as a project is switched to Kotlin, editing of its settings is disabled in the UI (except a few pages: Versioned settings, Maven Settings, SSH keys and Meta-runners). If you need to enable editing, switch versioned settings to XML format or disable versioned settings.
Since TeamCity 2017.2, project and build configuration settings will be available for editing from the web UI. See details in the section above.
Once you apply the versioned settings to your project, TeamCity will generate necessary Kotlin files for this project and check them in to the specified repository under the
.teamcitydirectory. If this repository already contains project settings in the XML format, they will be preserved, but TeamCity will no longer use them: once you get familiar with Kotlin files, these xml files can be removed.
You can create a new project via DSL inside a parent project which already has uses settings in the Kotlin format. A new project can be added either in its own directory with
settings.kts or using the
subProject() method in the parent project.
Prior to TeamCity 2017.2, no external resources are supported and since
Since TeamCity 2017.2, it is possible to use external libraries in your Kotlin DSL code. See details the section above.
TeamCity will apply the changes to configuration as follows: