Pregel 'Unsupported class file major version 62' error with JDK 16, Gradle 7.4.2

I'm trying to build pregel-bootstrap here : graph-data-science/examples/pregel-bootstrap at master · neo4j/graph-data-science · GitHub

First, it cannot find packages with the gdsVersion = '2.1.0-alpha04' parameter specified in build.gradle. So I changed the version to 2.04 and then it can find the packages. But this time, when I run ./gradlew shadowJar to build, it says 'Unsupported class file major version 62'. I checked this and only found with version 60 and it says that it's related to gradle version and gradle JVM version. I both tried jdk 11 and jdk 16 for gradle jvm and it gives the same error. I also tried with Gradle 7.0.

Which gradle, gradle-jvm and jdk version should I use in order to be able to build a pregel project with GDS version 2.0.4?

I found the issue. It seems that 'Unsupported class file major version 62' error is thrown when you use java 18 to compile the code. And even if I have chosen java 11 in intellijidea as gradle jvm and project jdk, it probably was hooked with java 18. When I completely delete java and reinstall 11 it worked.