Gradle execute task after test phase even if test has failed
build, gradle, java, testing
Solution
`test.doLast` doesn't add a new task, but adds another task action to the `test` task. What you can do instead is to declare a finalizer task:
task foo(type: ...) { ... } // regular task declaration
test.finalizedBy(foo)
This way, `foo` will run even if `test` has failed, similar to a Java `finally` block.
Problem
I am using gradle as my builder. After running all of my test I want to execute additional task. If there are no test failures ``` test.doLast { /*my task*/ } ``` works fine. But if there is at least one test failure my task does not execute. Is there a way to execute my task even if some of my test failed.