title: How to fail a task after it has run? Aka how to ignoreFailures but repeat the task on the next run?
body: <p>gradle cannot run both JUnit and TestNG tests in the same test task.</p>
  
  <p>So my idea was to create a second test task for TestNG, configure both test tasks with "ignoreFailures true" and have a separate task that generates a single test report for both tasks. Finally a test listener checks for test failures and lets the build fail if needed.</p>
  
  <p>Unfortunately that way when a test is failing the build will fail only the first time around. On the second invocation (of "gradlew build"), the build is incorrectly considered successful. I guess that's because the ignoreFailures makes gradle consider the test task to always be successful and since no input or output changed it does not run the tests again.</p>
  
  <p>Is there a way to tell gradle to continue after test failures, but still re-run the task the next time? So for example mark the task as dirty programmatically?</p>
  
  <p>Or, put another way: Can I have the same effect as the "--continue" command line argument, but right in the build setup and only for specific tasks?</p>
  
  <p>Any other idea for a solution? Can I somehow use/add local task state for that?</p>
  
  <p>Example code is at <a href="https://github.com/eekboom/gradle-dual-tests" rel="nofollow noreferrer">https://github.com/eekboom/gradle-dual-tests</a></p>