Compartilhar via


Ant@1 - Ant v1 task

Use this task to build with Apache Ant.

Inputs

buildFile - Ant build file
Input alias: antBuildFile. string. Required. Default value: build.xml.

The relative path from the repository root to the Ant build file.

For more information about build files, see Using Apache Ant.


options - Options
string.

Provides options to pass to the Ant command line. You can provide your own properties (for example, -DmyProperty=myPropertyValue) and also use built-in variables (for example, -DcollectionId=$(system.collectionId)). Alternatively, the built-in variables are already set as environment variables during the build and can be passed directly (for example, -DcollectionIdAsEnvVar=%SYSTEM_COLLECTIONID%).

See Running Apache Ant.


targets - Target(s)
string.

An optional, space-separated list of targets to build. If not specified, the default target will be used. If no default target is defined, Ant 1.6.0 and later will build all top-level tasks.

See Using Apache Ant Targets.


publishJUnitResults - Publish to TFS/Team Services
boolean. Default value: true.

Select this option to publish JUnit test results produced by the Ant build to TFS/Team Services. Each test results file matching Test Results Files will be published as a test run in TFS/Team Services.


testResultsFiles - Test results files
string. Required when publishJUnitResults = true. Default value: **/TEST-*.xml.

The test results file path. Wildcards can be used. For more information, see the file matching patterns reference. For example, **/TEST-*.xml for all XML files whose name starts with TEST-.


testRunTitle - Test run title
string. Optional. Use when publishJUnitResults = true.

Provides a name for the test run.


codeCoverageToolOptions - Code coverage tool
Input alias: codeCoverageTool. string. Allowed values: None, Cobertura, JaCoCo. Default value: None.

Selects the code coverage tool.

If you are using the Microsoft-hosted agents, then the tools are set up for you. If you are using the on-premises Windows agent, you must ensure the agent is set up for either JaCoco or Cobertura.

  • JaCoCo - ensure that jacocoant.jar is available in the lib folder of Ant installation. Learn more about JaCoCo Ant tasks.
  • Cobertura - ensure that an environment variable COBERTURA_HOME points to the Cobertura .jar files location. Learn more about Cobertura with Ant tasks.

After you select one of these tools, the following arguments appear:


codeCoverageClassFilesDirectories - Class files directories
Input alias: classFilesDirectories. string. Required when codeCoverageTool != None. Default value: ..

The comma-separated list of relative paths from the Ant build file to directories containing class files and archive files (.jar, .war, etc.). Code coverage is reported for class files in these directories. For example: target/classes,target/testClasses.


codeCoverageClassFilter - Class inclusion/exclusion filters
Input alias: classFilter. string. Optional. Use when codeCoverageTool != None.

The comma-separated list of filters to include or exclude classes from collecting code coverage. For example: +:com., +:org., -:my.app*..


codeCoverageSourceDirectories - Source files directories
Input alias: srcDirectories. string. Optional. Use when codeCoverageTool != None.

The comma-separated list of relative paths from the Ant build file to source code directories. Code coverage reports will use these to highlight source code. For example: src/java,src/Test.


codeCoverageFailIfEmpty - Fail when code coverage results are missing
Input alias: failIfCoverageEmpty. boolean. Optional. Use when codeCoverageTool != None. Default value: false.

Fails the build if the code coverage did not produce any results to publish.


antHomeDirectory - Set ANT_HOME path
Input alias: antHomeUserInputPath. string.

If set, overrides any existing ANT_HOME environment variable with the given path.


javaHomeOption - Set JAVA_HOME by
Input alias: javaHomeSelection. string. Required. Allowed values: JDKVersion (JDK Version), Path. Default value: JDKVersion.

Sets JAVA_HOME either by selecting a JDK version that will be discovered during builds or by manually entering a JDK path.


jdkVersionOption - JDK version
Input alias: jdkVersion. string. Optional. Use when javaHomeSelection = JDKVersion. Allowed values: default, 1.9 (JDK 9), 1.8 (JDK 8), 1.7 (JDK 7), 1.6 (JDK 6). Default value: default.

Attempts to discover the path to the selected JDK version and sets JAVA_HOME accordingly.


jdkUserInputDirectory - JDK path
Input alias: jdkUserInputPath. string. Required when javaHomeSelection = Path.

Sets JAVA_HOME to the given path.


jdkArchitectureOption - JDK architecture
Input alias: jdkArchitecture. string. Optional. Use when jdkVersion != default. Allowed values: x86, x64. Default value: x64.

Optionally supplies the architecture (x86, x64) of the JDK.


Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

None.

Remarks

Use this task to build with Apache Ant.

Requirements

Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands Self-hosted agents must have capabilities that match the following demands to run jobs that use this task: ant
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 1.89.0 or greater
Task category Build