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

Shan

11/25/2019, 1:52 AM
Anyone know why when I try to call Java classes from JvmTest I get an
Unresolved Reference
error? Project structure is like
Copy code
proj
  |_ commonMain
  |_ commonTest
  |_ jvmMain
      |_ kotlin
          |_ com.my.package.keys
              |_ KeyPairJ.java
  |_ jvmTest
      |_ kotlin
          |_ com.my.package
              |_ KeyPairTest
Getting this error every time I try to run a test:
e: ../src/jvmTest/kotlin/com/my/package/KeyPairTest.kt: (13, 19): Unresolved reference: KeyPairJ
My build file is set up like so
Copy code
//ommitted some things

kotlin {
    jvm()
    js()

    sourceSets {
        //omitted some stuff
        val jvmMain by getting {
            dependencies {
                implementation(kotlin("stdlib-jdk8"))
                //other stuff- ktor, coroutines, etc.
            }
        }
        val jvmTest by getting {
            kotlin("test")
            kotlin("test-junit")
        }
    }
}
Very confused here.. I can call code from
commonMain
fine, just not from
jvmMain
🤔
r

russhwolf

11/25/2019, 12:43 PM
s

Shan

11/26/2019, 4:18 AM
Ah, I was using
withJava()
but did not put the java files into their own
java
directory. That did the trick. Thank you!