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

Riccardo Montagnin

03/12/2019, 6:42 AM
Hello everyone. Is it possible to run the tests inside
commonTest
without any
jvm
or other module? If I try to run
gradle check
I get the following error:
Copy code
> Task :compileKotlinJvm 

e: ...: Unresolved reference: Json
Where
Json
is imported as
Copy code
import kotlinx.serialization.json.Json
And my dependencies are the following:
Copy code
kotlin.sourceSets {
    commonMain.dependencies {
        api "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serialization_version"
    }
}
s

spand

03/12/2019, 6:45 AM
Since there is no kotlin vm yet what is the problem with running it on the jvm ?
r

Riccardo Montagnin

03/12/2019, 6:51 AM
I just wanted to create a pure multiplatform project and found no guide on how to set up common modules to run on the JVM. Also, as you can see here, the
commonMain
module has all the dependencies, but running the tests on the JVM does not seem to see them
s

spand

03/12/2019, 6:54 AM
You still need to include the jvm version (
kotlinx-serialization-runtime
) as a jvm dependency
💯 2
r

Riccardo Montagnin

03/12/2019, 6:57 AM
Thank you, missed that out
s

Sam

03/12/2019, 12:54 PM
Conceptually common modules don't exist outside of a platform. They don't exist on their own even if they don't use any expect/actual classes.
2 Views