TeamCity On-Premises 2021.1 Help

Kotlin Script

The Kotlin Script runner allows executing a Kotlin script on Windows, Linux, or macOS.

Refer to Configuring Build Steps for a description of common build steps' settings.

Prerequisites

A Kotlin compiler version 1.3.70 or later must be installed as an agent tool to run this step. Kotlin 1.4.31 is already bundled with TeamCity, but you can install other versions if necessary.

Kotlin settings

Setting

Description

Kotlin compiler

Select a compiler version: use the bundled or default version, or enter a custom path to the compiler, relative to the build checkout directory.

Script type

Choose one of the two options: enter a custom script body right inside the runner or specify a path to a Kotlin script file (.kts ).

Kotlin script

Available for the Custom Script type.

Enter a code of a Kotlin script.

If you want to extend the script's functionality with external libraries, you can use annotation-based references to Maven dependencies. For example:

@file:Repository("https://mvnrepository.com") @file:DependsOn("com.google.code.gson:gson:2.8.6") import com.google.gson.Gson ...

See Kotlin Help for details.

Kotlin script file

Available for the Script File type.

Enter a path to the script file, relative to the build checkout directory.

To support annotation-based references, the provided file must have the .main.kts extension.

Script parameters

Enter the parameters of the script, as in the command line. Parameter references are supported.

JDK

Select JDK to run the script:

  • Default: the path to JDK Home is read either from the JAVA_HOME environment variable on the agent machine, or from the env.JAVA_HOME property specified in the build agent configuration file (buildAgent.properties ). If these values are not specified, TeamCity uses the Java Home of the build agent process itself.

  • Custom: enter a path to a JDK installed on the agent.

  • Select any installed version by number.

JVM command line parameters

Specify JVM command line parameters: for example, maximum heap size or parameters enabling remote debugging. These values are passed by the JVM used to run your build.

Example:

-Xmx512m -Xms256m
Last modified: 12 April 2021