Upgrade to Gradle 6.7 and use toolchains for per-JDK builds
The idea is to use:
One JDK to run Gradle: whatever it needs, let's say JDK8.
One JDK to build the "main", published code: JDK8.
One JDK to build and run the tests: JDK 8 / 11 / 15 / 16, in different Jenkins jobs.
That can be done in Gradle 6.7 with the help of toolchains. We've already done it in Hibernate Reactive: https://github.com/hibernate/hibernate-reactive/pull/430
btw, Gradle 6.8 was just released
Wow, very nice!