admin管理员组文章数量:1122846
I'm trying to use KSP to process annotations and generate some code, but I'm encountering a problem. When I modify the upstream code, the downstream module's code doesn't trigger a compilation, and KSP doesn't generate code for it.
My project structure is as follows:
rootProjects
module-ksp
module-core
implementation(project(":module-ksp"))
module-other
implementation(project(":module-ksp"))
implementation(project(":module-core"))
Currently, when I compile the entire project, KSP generates code for all modules correctly. However, if I modify the code in the ksp
or core
module and then compile, KSP only regenerates code for ksp
and core
. The code generated by KSP in the other
module is automatically deleted, causing reflection exceptions at runtime.
The content of my rootProject
's build.gradle.kts
is as follows:
plugins {
id("java")
kotlin("jvm") version "2.0.21"
id("com.google.devtools.ksp") version "2.0.21-1.0.25"
}
subprojects {
apply(plugin = "kotlin")
apply(plugin = "java")
apply(plugin = "com.google.devtools.ksp")
if (name != "module-ksp") {
dependencies {
implementation(project(":module-ksp"))
ksp(project(":module-ksp"))
val globalImplementationList = arrayOf(
"it.unimi.dsi:fastutil:8.5.15",
"com.alibaba:fastjson:2.0.53",
)
globalImplementationList.forEach { implementation(it) }
if (name != "module-core") {
implementation(project(":module-core"))
}
}
}
}
repositories {
mavenCentral()
}
In theory, when I modify a module that module-other
depends on, KSP should either regenerate the code for the submodule or leave the already generated code untouched.
I want to know what the problem is and how to solve it.
本文标签:
版权声明:本文标题:kotlin - What should I do if the files generated by KSP are frequently being automatically deleted? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736305001a1932434.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论