title: Compiling a Gradle Java project with Java 8 but running tests with Java 11
body: <p>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.</p>
  <p>My projects are Gradle projects (6.+ if it matters), using the <code>java</code> plugin or <code>java-library</code> plugins.</p>
  <p>I could not find a way to do it with Gradle options.</p>
  <p>I tried to compile (<code>gradlew build</code>) in one terminal with JDK-8, and then switch to another terminal with JDK 11 and run the tests (<code>gradlew test</code>), but it re-compiled the code.</p>
  <p>What is the correct way to do it?</p>