TeamCity 7.0 Help

Gradle

In order to run builds with Gradle, you need to have Gradle 0.9-rc-1 or higher installed on all the agent machines that you want the build be run on. Alternatively, if you use Gradle wrapper, you should have properly configured Gradle Wrapper scripts checked in to your Version Control.

Gradle Parameters

Option

Description

Gradle tasks

Specify Gradle task names separated by space. For example: :myproject:clean :myproject:build or clean build. If this field is left blank, the 'default' is used. Note, that TeamCity currently supports building Java projects with Gradle. Groovy/Scala/etc. projects building is not tested.

Incremental building

TeamCity can make use of Gradle :buildDependents feature. If incremental building checkbox is enabled, TeamCity will detect gradle modules affected by changes in build, and start :buildDependents command for them only. This will cause Gradle to fully build and test only modules affected by changes.

Gradle home path

Specify here the path to the Gradle home directory (parent of bin directory). If not specified TeamCity will use Gradle from an agent's GRADLE_HOME environment variable. If you don't have Gradle installed on agents, you can use Gradle wrapper instead.

Additional Gradle command line parameters

Optionally, specify the space-separated list of command line parameters to be passed to Gradle.

Gradle Wrapper

If this checkbox is selected, TeamCity will look for Gradle Wrapper scripts in the checkout directory, and launch the appropriate script with Gradle tasks and additional command line parameters specified in the above fields. In this case, Gradle specified in Gradle home path and the one installed on agent, are ignored.

Launching Parameters

Option

Description

Debug

Selecting the Log debug messages check box is equivalent to adding -d as Gradle command line parameter.

Stacktrace

Selecting the Print stacktrace check box is equivalent to adding -s as Gradle command line parameter.

Java Parameters

Option

Description

JDK home path

Use this field to specify the path to your custom JDK which should be used to run the build. If the field is left blank, the path to JDK Home is read either from the JAVA_HOME environment variable on agent computer, or from env.JAVA_HOME property specified in the build agent configuration file (buildAgent.properties). If these both values are not specified, TeamCity uses Java home of the build agent process itself.

JVM command line parameters

You can specify such JVM command line parameters as, 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

Build properties

Teamcity build properties are available in build script via "teamcity" property of the project. This property contains map with all defined system properties (see Defining and Using Build Parameters in Build Configuration for details). Following example contains task, that will print all available build properties to the build log (it must be executed by buildserver):

task printProperties << { teamcity.each { key, val -> println "##tc-property name='${key}' value='${val}'" } }

Code Coverage

To learn about configuring code coverage options with IDEA code coverage engine, please refer to the IntelliJ IDEA.

Last modified: 20 April 2023