How can I create a integration test task that will run the same test against multiple versions of the same library?

I want my integration test task to re-run my tests for multiple versions of the same library dependency to make sure my code works with all supported versions. Is this possible to do in gradle with only a single task, or do I need to create a test task for each version I want to test against?

I think the easiest way is with a task per variant you want to test against. You could set that up as a standard looking integTest task and then add a separate Configuration that extends integTestRuntime for each version you need to test against.

You can use common configuration closures to keep the duplication down and instead of using integTestRuntime as your classpath, you’d need to use the appropriate dependency configuration.