Ant Build Step
A build step running ant script
Example. Adds a simpe Ant build step with specified build file and targets. Default JDK is used.
buildType {
// Other Build Type settings ...
steps {
// Other Build Steps ...
ant {
name = "My Ant step"
mode = antFile {
path = "my-build.xml"
}
targets = "target1 target2"
}
Content copied to clipboard }
}
Example. Adds an Ant build step with build file content specified directly in the step settings. Custom working directory is set. Custom Ant setup is provided, as well as custom JDK home and JVM parameters are set. IDEA-based code coverage is configured.
buildType {
// Other Build Type settings ...
steps {
// Other Build Steps ...
ant {
name = "My Ant step"
mode = antScript {
content = """
// Example Build file
// content goes here ...
""".trimIndent()
}
workingDir = "ant-project/"
targets = "target1 target2"
antHome = "my-ant/home"
antArguments = "-quiet"
jdkHome = "%env.JDK_11_0%"
jvmArgs = "-Xmx512m"
coverageEngine = idea {
includeClasses = "org.sample.*"
excludeClasses = "org.sample.test.*"
}
}
Content copied to clipboard }
}
Example. Adds an Ant build step with build file content specified directly in the step settings to be run inside a Docker container. Custom test parameter is set. This build step will run even if some previous build steps are failed.
buildType {
// Other Build Type settings ...
steps {
// Other Build Steps ...
ant {
name = "My Ant step"
executionMode = BuildStep.ExecutionMode.RUN_ON_FAILURE
mode = antScript {
content = """
// Example Build file
// content goes here ...
""".trimIndent()
}
targets = "target1 target2"
reduceTestFeedback = AntBuildStep.TestPolicy.RECENTLY_FAILED_AND_MODIFIED
dockerImage = "myImage:2.4"
dockerImagePlatform = AntBuildStep.ImagePlatform.Linux
dockerPull = true
}
Content copied to clipboard }
}
See also
Types
Properties
Space-separated list of additional arguments for ant
Optional collection of build step execution conditions
Specifies coverage engine to use
Specifies which Docker image to use for running this build step. I.e. the build step will be run inside specified docker image, using 'docker run' wrapper.
Specifies which Docker image platform will be used to run this build step.
If enabled, "pull image" command will be run before docker run.
Additional docker run command arguments
Build step execution mode
Whether TeamCity should reorder tests to reduce test feedback
Build working directory for ant script, specify it if it is different from the checkout directory.
Functions
Executes the ant script at the given path
Executes the ant script with the given content
Deletes all configured build step conditions
Configures build step conditions
Copies parameters of this object to the specified target
Emma coverage engine Emma is out of date and it does not support Java 8. Consider using IntelliJ IDEA or JaCoCo coverage runners. Add a 'clean' target to your Ant build for this coverage runner to work.
Validates this object and reports found errors to the provided consumer