I am trying to build a project with a Kotlin backe...
# multiplatform
j
I am trying to build a project with a Kotlin backend to show how this will work. In my shared build.gradle file I have this:
Copy code
kotlin {
    android()
    iosX64()
    iosArm64()
    iosSimulatorArm64()
    jvm()
Near the end I have this:
Copy code
val jvmMain by getting {
            dependencies {
                implementation("io.ktor:ktor-client-apache:${Versions.ktor}")
            }
        }

    }
}

android {
    compileSdk = 32
    sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
    defaultConfig {
        minSdk = 30
        targetSdk = 32
    }
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_11.toString()
        freeCompilerArgs = listOf("-Xallow-jvm-ir-dependencies", "-Xskip-prerelease-check",
            "-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi", "-Xjvm-default=all"
        )
    }
}
It recognizes jvmMain as I had to include the expected functions. In my server build.gradle I have:
Copy code
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
    kotlin("jvm")
    id("kotlin-platform-jvm")
    id("war")
    id("application")
    kotlin("plugin.serialization")
    id("kotlinx-serialization")
}


dependencies {
    implementation(project(":shared"))
Snipped rest
}

kotlin {
    sourceSets.all {
        languageSettings {
            optIn("kotlin.RequiresOptIn")
        }
    }
}

java {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_1_8
}
When I look at anything from the shared project it goes to the androidMain version, not the jvmMain version. How do I get it to find the correct versions of the classes?
This is my directory structure for the two affected parts, and my code is now at https://github.com/jblack975/MyOutfitPicker