TestNG Ant Task has haltonfailure, how do you do this with gradle when using TestNG?

TestNG Ant Task has haltonfailure ( http://testng.org/doc/ant.html ), how do you do this with Gradle (halt on a TestNG test failure) when using TestNG?

As far as I can tell from the documentation, setting the TestNG Ant task’s ‘haltonfailure’ property to ‘true’ makes the build fail if a test failure has occurred, but only after the task has completed executing its tests. This is Gradle’s default behavior and can be controlled via the ‘Test’ task’s ‘ignoreFailures’ property.

So it looks like if you want to halt the build on the first test failure you have to make it happen with custom code. Before posting my question I had done this by halting the build on the first test failure by adding my own listener. Unfortunately I had to ultimately use a System.exit( 1 ); to actually halt the build (I tried throwing some of the types of Gradle exceptions to halt the build immediately but was unsuccessful).

I’m not aware of a good way to stop execution of tests at the first failure, neither in Gradle nor in Ant. Why is this important to you? Feel free to submit a feature request.