As the first part of a transition process of my projects, I would like to keep compile with JDK-8 compiler, but execute tests with JDK-11 runtime.
My projects are Gradle projects (6.+ if it matters), using the
java plugin or
I could not find a way to do it with Gradle options.
I tried to compile (
gradlew build ) in one terminal with JDK-8, and then switch to another terminal with JDK 11 and run the tests (
gradlew test ), but it re-compiled the code.
What is the correct way to do it?