Plugin project CI (e.g. Travis): integration-tests cross-Gradle versions

I have a Gradle plugin project, which currently builds itself using the Gradle Wrapper to run 4.10.2, which is upgraded from time-to-time. Integration tests run on Travis CI and are launched using a nested build and a GradleBuild task. Therefore, integration-tests, which load the plugin, run using a nested build and the same version of Gradle as the pre-tests build itself.

I would like to be able to run integration-tests against different versions of Gradle, to catch any past/future incompatibilities or issues. I’d especially like to test against beta and GA Gradle 5.0 builds.

What is the best way of achieving this? I don’t want the main plugin build to vary (since this is what will be distributed) - it will be built once using a fairly recent version of Gradle, but I do want to be able to have a Travis matrix load that plugin into different Gradle versions to run the integration-tests.

The main option I can see at the moment is to orchestrate this at the shell level, and to split my current ./gradlew build integrationTest into two executions, with something in the middle. That something might need to be a ./gradlew wrapper --gradle-version $GRADLE_VERSION, creating/updating a private wrapper config for the integration-tests to run.

Does anyone cross-test Gradle Plugins against multiple Gradle versions and run integration-tests in CI e.g. Travis, and can outline any best practices or insights on the above?