A Kotlin compiler plugin for transforming suspend functions to platform-compatible non-suspend functions, such as the JVM Blocking API and CompletableFuture or JS Promise, etc. 🐱
MIT License
36
stars
3
forks
source link
Unable to load class 'org.jetbrains.kotlin.name.FqName' #65
When I try to upgrade the Kotlin version from 2.0.20 to 2.1.0-Beta1, I get the following error when referencing the plugin in Gradle:
Unable to load class 'org.jetbrains.kotlin.name.FqName'
org.jetbrains.kotlin.name.FqName
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
This worked in 2.0.20 (and earlier), but not in 2.1.0-Beta1.
I'm guessing that perhaps in 2.1.0-Beta1 there was some change in the way dependencies are passed within Gradle's kotlin plugin, so that the kotlin-compiler doesn't do it anymore.
I'm going to keep the original way of compiling and distributing in the 2.1.0-Beta1-0.9.2 version of this plugin for now.
If you have a similar problem after updating Kotlin with this plugin, try the following solution.
plugins {
kotlin("jvm") version "2.1.0-Beta1"
id("love.forte.plugin.suspend-transform") version "2.1.0-Beta1-0.9.2"
}
group = "..."
version = "..."
buildscript {
repositories {
mavenCentral()
}
dependencies {
// Add `kotlin-compiler` for classpath here
classpath("org.jetbrains.kotlin:kotlin-compiler:2.1.0-Beta1")
}
}
suspendTransform {
// ...
}
However, in local testing I'm not sure if using id("...") directly works, so if the above doesn't work, you can try that too:
plugins {
kotlin("jvm") version "2.1.0-Beta1"
}
group = "..."
version = "..."
buildscript {
repositories {
mavenCentral()
}
dependencies {
// Add plugin for classpath here
classpath("love.forte.plugin.suspend-transform:suspend-transform-plugin-gradle:2.1.0-Beta1-0.9.2")
// Add `kotlin-compiler` for classpath here
classpath("org.jetbrains.kotlin:kotlin-compiler:2.1.0-Beta1")
}
}
apply(plugin = "love.forte.plugin.suspend-transform")
extensions.getByType<SuspendTransformGradleExtension>().apply {
// ...
}
If this persists until after 2.1.0 is released, then I'll change the kotlin-compiler passability from compileOnly to implementation (or api ?).
[!note]
If there is a better solution, or if I have said or understood anything wrong, feel free to share or correct me!
When I try to upgrade the Kotlin version from 2.0.20 to 2.1.0-Beta1, I get the following error when referencing the plugin in Gradle:
After some experimentation, I realized that the
kotlin-compiler
that the plugin depends on iscompileOnly
if the compilation and distribution configuration of this plugin remains unchanged. Reference: https://github.com/ForteScarlet/kotlin-suspend-transform-compiler-plugin/blob/41cf886fb6eaeb1d9c225fc081b560d8cff92998/compiler/suspend-transform-plugin/build.gradle.kts#L18This worked in
2.0.20
(and earlier), but not in2.1.0-Beta1
. I'm guessing that perhaps in 2.1.0-Beta1 there was some change in the way dependencies are passed within Gradle's kotlin plugin, so that thekotlin-compiler
doesn't do it anymore.I'm going to keep the original way of compiling and distributing in the
2.1.0-Beta1-0.9.2
version of this plugin for now. If you have a similar problem after updating Kotlin with this plugin, try the following solution.However, in local testing I'm not sure if using
id("...")
directly works, so if the above doesn't work, you can try that too:If this persists until after
2.1.0
is released, then I'll change thekotlin-compiler
passability fromcompileOnly
toimplementation
(orapi
?).