Hi everyone I tried updating koin-annotations, but...
# koin
r
Hi everyone I tried updating koin-annotations, but every version after 2.1.0 leads to errors
[ksp] --> Unreachable definition
for every definition with annotations. I initialized the modules by default modules, but updated to the
@KoinApplication
way when trying to update to koin-annotations 2.3.1, but nothing worked. With koin-annotations 2.1.0 everything works as it should. Am I missing something when updating? Kotlin version: 2.2.21 KSP version: 2.3.2 Koin version: 4.1.1
r
Oh, I see, I missed that I have to change from
modules()
to
@Configuration
. Thanks very much for the hint.
💪 1
r
same issue prevented me from updating, just stuck to the old version
g
Note that @Configuration doesn't work yet on a KMP project, so we need to keep using modules() for the meantime
😢 1
r
Interesting 🤔 I got the error in a KMP project when not using @Configuration. After adding it and removing modules() inside startKoin() it worked.
g
Really? How come? There's a bug in KSP2 from scanning properly all modules, maybe its a single module project?
r
Ah, I have referenced the shared module via
Copy code
@Module(
    includes = [
        SharedMapperModule::class
    ]
)
@Configuration
@ComponentScan("<http://com.example.app|com.example.app>")
class MapperModule
This way I have the SharedMapperModule that scans inside the shared module and the MapperModule that includes this and scans inside the app module
g
This defeats the purpose of
@Configuration
IMHO, but we shall wait and see, I am sure Google will fix that issue at some point and then this will work in KMP as well
r
Thats true, but also was the way I used it before updating past 2.1.0 For me it‘s a nicer way than adding some modules via modules() ond the ones in the project itself with @Configuration
r
@galex is there a timeline for when
@Configuration
would work on kmp?
g
@arnaud.giuliani is working on a Koin Compiler Plugin instead of KSP, so when this is available or KSP fixes their bug 🤣
kodee happy 1
r
It's not stated anywhere in the docs
g
And here is the related KSP issue https://github.com/google/ksp/issues/2695
r
I'm running out of hobby projects to keep up with koin's changes these days
😂 1