We use KotlinPluginWrapper.kotlinPluginVersion
to get the kotlin version in boot gradle plugin as advised in #11711. But the jetbrains developers have removed the property kotlinPluginVersion
recently in this change. So if we try to upgrade kotlin to 1.5.20-RC, we will see the error
* Exception is:
java.lang.NoSuchMethodError: 'java.lang.String org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper.getKotlinPluginVersion()'
at org.springframework.boot.gradle.plugin.KotlinPluginAction.execute(KotlinPluginAction.java:36)
at org.springframework.boot.gradle.plugin.KotlinPluginAction.execute(KotlinPluginAction.java:32)
at org.springframework.boot.gradle.plugin.SpringBootPlugin.lambda$null$0(SpringBootPlugin.java:126)
...
which prevents us from upgrading kotlin to 1.5.20-RC. Latest boot release 2.5.1 still has the issue.
Comment From: wilkinsona
Thanks for letting us know. That's an unfortunate breaking change in Kotlin's Gradle plugin. It looks like we may be able to retrieve the version by looking for the project.version
in the project.properties
file. That's what Kotlin's Gradle Plugin is doing under the covers so it should be safe for us to do the same I think.
Comment From: materemias
@wilkinsona is there a workaround we could utilize until the fix comes?
Comment From: wilkinsona
I can't think of one, unfortunately.
Comment From: materemias
thanks anyways
Comment From: wilkinsona
I've reached out to Jetbrains to see if they can reinstate the accessor or point us to another mechanism to get the version that doesn't require us to read their properties file.
Comment From: Tapchicoma
Method signature in 1.5.20
was changed - now it is an extension function for the Project
object. Will it work for you?
Comment From: wilkinsona
No, I don't think so as we don't want to require 1.5.20. We'd like to be able to support any 1.5.x version with the same code.
Comment From: wilkinsona
@Tapchicoma has kindly opened https://youtrack.jetbrains.com/issue/KT-47317 so I think we can close this one. I've also opened a Boot issue so that setting kotlin.version
manually will be a workaround for this sort of problem in the future.