我正在构建一个 Kotlin 多平台项目。在我的主 build.gradle
文件中,我定义了几个模块及其依赖项:
plugins {
id 'com.android.library'
id 'kotlin-multiplatform' version '1.3.21'
}
android { ... }
apply plugin: 'maven-publish'
kotlin {
android()
jvm {
compilations.main.kotlinOptions {
jvmTarget = "1.8"
}
compilations.test.kotlinOptions {
jvmTarget = "1.8"
}
}
sourceSets {
commonMain.dependencies {
api project(':core')
implementation kotlin('stdlib-common')
}
commonTest.dependencies {
implementation kotlin('test-common')
implementation kotlin('test-annotations-common')
}
jvmMain.dependencies {
implementation kotlin('stdlib-jdk8')
}
jvmTest.dependencies {
implementation kotlin('test')
implementation kotlin('test-junit')
}
androidMain.dependencies { ... }
androidTest.dependencies { ... }
}
}
尽管项目构建并运行良好,但 IDEA 会针对所有这些依赖项显示警告: