I have an integration test source set in gradle, and it is dependent on my main classes being compiled. I set that up by doing
integrationTestClasses.dependsOn \
What's missing is:
dependencies { integrationTestCompile sourceSets.main.output }
With this in place, task dependencies should be established automatically.