The problem is that ‘startContainer’ should not run if ‘integrationTest’ is up-to-date. Would be nice if I could ask a task if it is up-to-date so I could put that in an ‘onlyIf’ closure, for example.
The problem is, that the calculation if integrationTest is up-to-date happens AFTER the startContainer task was executed. You (or better say your gradle build) would need to validate the up-to-date state of integrationTest when evaluating up-to-date state of startContainer. I’m afraid there is no (public) API available to do that in your build script atm.
By executing the startContainer task manually from inside a ‘doFirst’ closure in ‘integrationTest’, I got it to only run when ‘integrationTest’ was not up-to-date.