Is there any way to get the Kotlin version that th...
# gradle
e
Is there any way to get the Kotlin version that the project is using (not the version that Gradle is using) in a buildscript?
c
Could grab it from the version catalog
e
I don't have access to it in this project
j
KGP has a function to get it, don’t remember exactly the name, try getKotlinVersion or something with KotlinVersion
e
I tried all the ones I could find but they gave me gradle's embedded version
c
Why isn’t there version catalog access?
e
I'm in a plugin
j
Copy code
println("Kotlin version: ${getKotlinPluginVersion()}")
Copy code
org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion
that should work
e
Odd it's printing 1.8.20 for me even though I'm using 1.9.0. I'll do some more testing
c
The plug-in version is different than the language version of you’ve explicitly set that.
e
I know, I'm using the 1.9.0 plugin
j
maybe classpath issues? are you setting the plugin version in the root with apply false or in the buildscript block?
e
I must've had something configured wrong, it's working now. Thanks!