Wondering why it explicitly targets 1.8 (when Java 11 LTS is available or even Java 17 now )
That code looks related to Kotlin Gradle buildscript support and since current Gradle versions support running in Java 8 I’m guessing that’s why.
Hmm Gradle 7.3 support’s java 17 Gradle 7.3-rc-1 Release Notes and on that branch/tag this is still targeting 1.8 gradle/KotlinBuildScript.kt at v7.3.0-RC5 · gradle/gradle · GitHub
Yes, but Gradle still needs to be able to execute on Java 8 (the minimum supported version that Gradle 7 will run on), so its buildscript support needs to remain compatible.
Note; this has nothing to do with the bytecode generated for your application, via the Kotlin Gradle plugin. I’ve never used that plugin so I cannot comment on the details of setting the target jvm version.