title: run stop tomcat task if test task fails in gradle project
body: <p>I am working on a gradle project. I have written few tests for it.
  In build.gradle, I have written three tasks for it: tomcatStart, tomcatEnd and test.
  Inside test task, i am executing tomcatStart in doFirst and tomcatStop in doLast. 
  It all works fine if there is no test failure. 
  But if a test fails, the tomcat keeps on running.</p>
  
  <p>I want to know if there is any way, i can stop tomcat even if test task fails.</p>