Hey everyone, best wishes! I’m currently migratin...
# kvision
s
Hey everyone, best wishes! I’m currently migrating to version
6.0.1
with Kotlin
1.8.0
(mandatory I would assume from the build errors it gave me?). Gradle sync works fine, but when I try to build the project I’m presented with following error:
PROJECTPATH/build/generated/ksp/metadata/commonMain/kotlin/be/sigmadelta/PROJECTNAME/service/UserService.kt:15:9 Cannot inline bytecode built with JVM target 17 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
So then I change the
jvmTarget
to `17`as prompted (see below):
Copy code
jvm("backend") {
        compilations.all {
            java {
                targetCompatibility = JavaVersion.VERSION_1_8
            }
            kotlinOptions {
                jvmTarget = "17"
                freeCompilerArgs = listOf("-Xjsr305=strict")
            }
...
Afterward I try to build again, but then it encounters a build error in `Main.kt`:
Copy code
e: PROJECTPATH/src/backendMain/kotlin/be/sigmadelta/PROJECTNAME/Main.kt:56:5 None of the following functions can be called with the arguments supplied: 
public fun Application.kvisionInit(vararg modules: Module): Injector defined in io.kvision.remote
public fun Application.kvisionInit(initStaticResources: Boolean, vararg modules: Module): Injector defined in io.kvision.remote
public fun Application.kvisionInit(initStaticResources: Boolean, json: Json, vararg modules: Module): Injector defined in io.kvision.remote
public fun Application.kvisionInit(json: Json, vararg modules: Module): Injector defined in io.kvision.remote
And this happens on an unchanged
kvisionInit
which worked fine on version `5.18.1`:
Copy code
fun Application.main() { 

...

kvisionInit(
        Json {
            prettyPrint = true
            isLenient = true
            classDiscriminator = "class"
        },
        KoinModules.tableModule,
        KoinModules.repoModule,
        KoinModules.serviceModule,
        KoinModules.appModule(
            this@main,
            JwtProps(
                secret = environment.config.property("jwt.secret").getString(),
                issuer = environment.config.property("jwt.issuer").getString(),
                audience = environment.config.property("jwt.audience").getString(),
                realm = environment.config.property("jwt.realm").getString()
            )
        )
    )
...
Does anyone know how to resolve this issue? I assume something is just going wrong with the mandatory Kotlin upgrade to
1.8.0
r
Have you changed
JavaVersion.VERSION_1_8
to
JavaVersion.VERSION_17
as well?
Do you run your build with JDK17?
s
I just changed over the
JavaVersion.VERSION_1_8
to
JavaVersion.VERSION_17
, and the
javaVersion
mentioned in
gradle.properties
to
17
as well; but it makes no difference currently. My project is also configured to use the
Zulu JDK 17
, tried switching over to the Jetbrains JDK 17 but that also doesn’t make a difference currently
r
have you tried running gradlew from command line?
s
Yes,
./gradlew clean assemble
results in the same build errors as in the IDE so I assume it’s not IntelliJ related
r
Can you share your project?
s
Sure, I can invite you through Github
r
You need to upgrade Koin to 3.3.0
It resolves the problem with
kvisionInit
There are some other compilation issues after that
but in the frontend module and they are expected
s
Seems to fix the backend part already indeed, thanks! 👍
r
one is the routing and the other is probably onClick return value
both are described in the migration guide
s
As for the front end, I’ve removed the bootstrap modules mentioned but I’ll have to look into deprecation of the
add(
methods and such
Thanks for the help!
r
the add method is not deprecated
you just need to add a button and not button.onClick() {} result value
(which is not a button anymore)
s
Super, all resolved now and project works again. Thanks!
r
Glad I could help :)
s
So for reference to anyone encountering the same/similar issues: General: • Upgrade to Kotlin 1.8.0 • Upgrade Koin to 3.3.0 Frontend: • Run
./gradlew kotlinUpgradeYarnLock
if required by IntelliJ • Follow migrationguide details