Overwrite Gradle's "BUILD SUCCESSFUL" message

Hi, In my build.gradle, I invoke ant api as followed

ant.taskdef(name: ‘sshexec’, classname: ‘org.apache.tools.ant.taskdefs.optional.ssh.SSHExec’, classpath: configurations.sshAntTask)

ant.sshexec(host: myhost, username: mylogin, password: mypass, command: “cd /xyz”, trust: ‘true’, failonerror: ‘false’)

In this scenario, since /xyz does not exists, it will failed and return by ant.sshexec.

But, from gradle, it will still show “BUILD SUCCESSFUL”.

Is there any way to overwrite this based on the result of calling ant.sshexec such that it will show “BUILD FAILED”?

thanks, ct

It should be good enough to not set ‘failOnError’.