TeamCity 8.0 Help

Ant

This is a runner for Ant build.xml files. TeamCity comes bundled with Ant 1.8.2, and since TeamCity 8.1- with Ant 1.8.4.

Support for Running Parallel Tests

By using the <parallel> tag in your Ant script, it is possible to have the JUnit and TestNG tasks run in parallel. TeamCity supports this and should concurrently log the parallel processes correctly.

Ant Runner Settings

Ant Parameters

Option

Description

Path to build.xml file

If you choose the option, you can type the path to an Ant build script file of the project. The path is relative to the project root directory.

Build file content

If you choose this option, click the Type build file content link and type the source code of your custom build file in the text area. Note that the text area is resizeable. Use the Hide link to close the text area.

Working directory

Specify the Build Working Directory if it differs from the checkout directory.

Targets

Use this text field to specify valid Ant targets as a list of space-separated strings. If this field is left empty, the default target specified in the build script file will be run.

Ant home path

Specify the path to the distributive of your custom Ant. You do not need to specify this parameter if you are going to use the Ant distributive bundled with TeamCity (Ant 1.8.2, since TeamCity 8.1, Ant 1.8.4).

Additional Ant command line parameters

Optionally, specify additional command line parameters as a space-separated list. For example, you can specify the here (see below).

ant-net-tasks Tool

The Ant build runner comes with a bundled tool, ant-net-tasks, which includes the jar files required for network tasks, such as FTP, sshexec, scp and mail. It also contains missing link Ant task which can be used for REST requests.

To use the tool, specify -lib "%\teamcity.tool.ant-net-tasks%" in antAddAntCommandLineOptionDescription of the runner settings.

Java Parameters

Option

Description

JDK home path

Use this field to specify the path to the JDK which should be used to run the build (launch Ant). If the field is left blank, the value of JAVA_HOME environment variable is used. (The variable can come from the build configuration settings, or agent environment, or properties). If JAVA_HOME is not found, TeamCity uses the Java home of the build agent process itself.

References to parameters can generate an Agent Requirements.

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

Test parameters

Tests reordering works the following way: TeamCity provides tests that should be run first (test classes), after that, when a JUnit task starts, it checks whether it includes these tests. If at least one test is included, TeamCity generates a new fileset containing included tests only and processes it before all other filesets. It also patches other filesets to exclude tests added to the automatically generated fileset. After that JUnit starts and runs as usual.

Option

Description

Reduce test failure feedback time:

Use the following two options to instruct TeamCity to run some tests before others.

Run recently failed tests first

If checked,TeamCity will first run tests failed in the previous finished or running builds as well as tests having a high failure rate (so called blinking tests).

Run new and modified tests first

If checked, before any other test, TeamCity will run the tests added or modified in the change lists included in the running build.

Code Coverage

To learn about configuring code coverage options, refer to the Configuring Java Code Coverage page.

Last modified: 20 April 2023