The Jtest Plugin for Ant is shipped with Jtest as a JAR file in the following location:
jtest-ant-plugin.jar to the build classpath in one of the following ways:
- Deploy the file in the Ant's libs directory:
Deploy the file in the Ant's system installation lib directory:
Note: If your IDE, continuous integration (CI) software, or other tools you are using use embedded Ant installations, the
$ANT_HOME/libdirectory is omitted and you need to use the
$HOME/.ant/libdirectory to add the JAR file.
Add the following parameter to the Ant command line each time you build and analyze your projects:
taskdeftasks in the root build script:
Configuring Jtest Execution
You can configure Jtest execution in an external XML build file, in the regular Ant XML build file, or in the command line – by specifying individual settings with the dedicated switch.
The following examples assume that jtest-ant-plugin.jar has been deployed into one of Ant's lib directories, so the command line argument -lib is not used.
Configuring Analysis in the
You can configure analysis by modifying Ant's
Configuring Analysis in the External XML Build File
You can configure analysis in the external
jtest.xml build file.
The above example shows the
home parameter configured in three different ways in the descending hierarchical order:
- Directly in the task tag.
- With the project property (the property task).
- With the with JVM environment variable. You can configure Jtest options using the
-Dcommand line option, for example -Djtest.home=value.
Note: The built-in Ant options have priority over Jtest options. If Ant options are used for configuration, they override values passed with the Jtest-D.
Advanced Configuration in the XML Build File
The following configuration loads the
jtest-ant-plugin.jar and starts the listener form the build file. As a result:
- Ant command line does not require any additional options to execute analysis with Jtest
- you don't need to pass jtest-ant-plugin.jar with the -lib option or deploy the file in the $ANT_HOME/lib directory
Configuring Analysis in the Command Line
You can configure analysis in the command line by passing individual settings with the
-Dproperty option (
-Dproperty.KEY=VALUE). For example:
Manual Customization of Compilation Data
In rare cases, highly customized Ant builds may lead to gaps or errors in the compilation data automatically detected by the Jtest Plugin for Ant. Jtest reports such issues in the Setup Problems section of the generated report, as well as in the console output. If you verify that the detected compilation data contains errors, you can extend or override the data in the build.xml file of the analyzed project.
The following example shows customized compilation data of an analyzed Ant build. The configuration is extended with an additional binary path element.
By default, Ant has no compilation
id. When the project triggers the javac task more then once, you must define an id for javac to match it with custom the compilation data. A custom compilation data configuration with no id will apply to all compilation data collected from the javac task that does not have the id parameter specified.
If you need to modify compilation data for all projects, you can use the
-Djtest.dataUpdate command line option.
See Compilation Data Model for more information about how to customize compilation data automatically detected by the Jtest plugins.