Job does not process any step commands after an ANT build command

Problem description:
The commands in a step after an ANT build command are not processed.
In the following step example, the echo command does not run.
<path to ant bin directory> ant -f <path to Java project>\build.xml build
echo "Ant build complete"
Explanation:
ANT builds return an error code of 1 whether the ANT build fails or succeeds.
In the Command property of a step, if multiple commands are used, only the exit status of the last command ran affects the step result status. When the server runs a command script for a step that contains an ANT build command, the error status of 1 causes any commands following the ANT build to fail.
Solution:
Create a step log filter to process the step output produced by the ANT build. The step log filter sets the step result and ensures that the next step in the job is processed.
  1. The ANT build should be the only command in the step or the last command in the step.

    Without a log filter, the ANT builds return an error code of 1 and the step result is set to fail.

  2. Create a log filter to search step output for the appropriate failure text string (BUILD FAILED) and effectively control step processing.

    If the text string is found, use the Set Fail action to set the step result to fail. When you use a step log filter, if the text string is not found, the step result is always set to pass.

    For details about setting log filters for steps, see Log filters.


Feedback