[英]How to configure JUnit 5 in a Kotlin multiplatform project using Gradle and IntelliJ?
[英]How to add a dependency in a multiplatform kotlin / native intellij project?
我有以下 build.gradle 配置:
plugins {
id 'org.jetbrains.kotlin.multiplatform' version '1.3.41'
}
repositories {
mavenCentral()
}
kotlin {
linuxX64("linux") {
binaries {
executable {
entryPoint = 'sample.main'
runTask?.args('')
}
}
}
sourceSets {
linuxMain {
dependencies {
api("org.http4k:http4k-core:3.183.0")
}
}
linuxTest {
}
}
}
以及以下源文件src/linuxMain/kotlin/sample/SampleLinux.kt
:
package sample
fun hello(): String = "Hello, Kotlin/Native!"
fun main() {
println(hello())
}
如何添加外部庫以便能夠在庫org.http4k:http4k-core:3.183.0
的導入中使用自動完成功能?
如您所見,我嘗試在 linuxMain 依賴項中添加行api("org.http4k:http4k-core:3.183.0")
,但是盡管 intellij 在 External Libraries 部分中顯示了該庫,但我無法使用包和類SampleLinux.kt
文件中的 http4k:任何org.http4k.....
導入嘗試都無法識別並生成編譯錯誤。
快速瀏覽后,我幾乎可以肯定http4k
是 JVM-only 庫,至少現在是這樣。 根據這個問題,他們還在等待 Native 成長。 如果您有興趣,可以再次詢問庫維護人員會很好。 至於 K/N 到去年增長了很多,也許他們改變了主意。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.