I’ve successfully built projects on Windows with OpenJDK 11 and Gradle 5.2.1. I’ve built some of the same projects on Linux with OpenJDK 12 and Gradle 5.2.1 and 5.3.1. One of those projects, I even compiled on Linux with 12 to a source and targetCompatibility of 1.7. And yet another one from 12 to 11 source and targetCompatibility.
In all cases, Gradle 5.2.1 and 5.3.1 just worked without me having to explicitly set anything in the way of JVM arguments.
I don’t have a solution to suggest to you. But could it be something specific to your environment?