https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
m

Mgj

07/29/2020, 12:46 PM
Im trying to set up a JVM target to run unit tests in. I have the following gradle setup:
Copy code
commonTest {
            dependencies {
                implementation(kotlin('test-common'))
                implementation(kotlin('test-annotations-common'))
            }
        }
        jvmTest {
            def mockk_version = "1.10.0"
            dependencies {
                dependsOn(commonTest)
                implementation kotlin('test')
                implementation kotlin('test-junit')
                implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$kotlin_serialization_version"
                implementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version"
                implementation "io.mockk:mockk:${mockk_version}"
                implementation "io.ktor:ktor-client-serialization-jvm:$ktor_version"
                implementation "io.ktor:ktor-client-json-jvm:$ktor_version"
            }
        }
However i think there's something funky going on with org.jetbrains.kotlinx:kotlinx-serialization even though supposedly it supports the JVM target - Every model i have which is annotated with
@Serializable
gives the following error:
error: incompatible types: Serializable cannot be converted to Annotation @java.io.Serializable()
r

rudolf.hladik

07/29/2020, 12:59 PM
kotlin
@Serializable
isn’t the same as
@java.io.Serializable
m

Mgj

07/29/2020, 1:00 PM
Right. But i'm not using java.io.Serializable, im only using kotlinx.serialization.Serializable
r

rudolf.hladik

07/29/2020, 1:01 PM
do you have applied Serializable gradle plugin?
m

Mgj

07/29/2020, 1:02 PM
Yes:
Copy code
plugins {
    id 'org.jetbrains.kotlin.plugin.serialization' version '1.3.72'
    id 'org.jetbrains.kotlin.multiplatform' version '1.3.72'
}
I can deploy to Android and iOS, but not JVM (where i want to run my tests)