9

I'm currently using ant for building my java project on a Windows XP machine. I have different tasks defined in the build.xml and one of this is the exec of a Python script for analyzing the application output. I would like to make ANT failing when a particolar tag is discovered by script. I'm trying using:

sys.exit(1)

or

os.system("EXIT 1")

the second one in particular execute the console command EXIT which successfully make the building process failing if executed inside a bath file.Unfortunately ant is not able to reveal the exit code from inside the launched script and goes on normally till the end showing a BUILD SUCCESSFUL message.

the script is called in this way:

<exec dir="${path}/scripts" executable="python">
        <arg line='log_analysis.py results.log" ' />
    </exec>

thanks for your help

1 Answer 1

17

Try this:

<exec dir="${path}/scripts" executable="python" failonerror="true">
    <arg line="log_analysis.py results.log" />
</exec>

Ant does not stop the build process if the command exits with a return code signaling failure by default; you have to set failonerror="true" to do that.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.