A solution that worked better for me than running things twice, was using Java 11, but telling Gradle to compile to Java 8.