kotlinネイティブにJavaライブラリを追加する方法

funbiscuit;

私はIntelliJのを使用して/ネイティブアプリケーションをkotlin作成しようとしましたので、(私が選択したテンプレートkotlin-> kotlin /プロジェクト作成でネイティブ)。これは、サンプルのGradleハローワールドプロジェクトを作成しました。通常のexeファイルと実行にすべての依存関係のコンパイルをダウンロードした後、どの。しかし、今、私はソムライブラリを含める必要があり、私はどのように把握することはできません。開始のために私はただのjarファイルのライブラリー(例えば、ジャクソン・コア)を含むようにしたいです。これは、build.gradleファイルがどのように見えるかです:

plugins {
    id 'kotlin-multiplatform' version '1.3.0'
}
repositories {
    mavenCentral()
}

kotlin {
    targets {
        // For ARM, preset should be changed to presets.iosArm32 or presets.iosArm64
        // For Linux, preset should be changed to e.g. presets.linuxX64
        // For MacOS, preset should be changed to e.g. presets.macosX64
        fromPreset(presets.mingwX64, 'mingw')

        configure([mingw]) {
            // Comment to generate Kotlin/Native library (KLIB) instead of executable file:
            compilations.main.outputKinds('EXECUTABLE')
            // Change to specify fully qualified name of your application's entry point:
            compilations.main.entryPoint = 'sample.main'
        }
    }
    sourceSets {
        // Note: To enable common source sets please comment out 'kotlin.import.noCommonSourceSets' property
        // in gradle.properties file and re-import your project in IDE.

        mingwMain {
        }
        mingwTest {
        }
    }
}


task runProgram {
    def buildType = 'release' // Change to 'debug' to run application with debug symbols.
    dependsOn "link${buildType.capitalize()}ExecutableMingw"
    doLast {
        def programFile = kotlin.targets.mingw.compilations.main.getBinary('EXECUTABLE', buildType)
        exec {
            executable programFile
            args ''
        }
    }
}

私が追加しようとしました

dependencies {
    implementation fileTree(dir: 'lib', include: ['*.jar'])
}

そして

dependencies {
    compile fileTree(dir: 'lib', include: ['*.jar'])
}

各セクションで、それは助けにはなりません。私はまだジャクソンパッケージからインポート何もできないし、それはアイデアの「外部ライブラリ」セクションには表示されません。まだ結果を - 私はまた、LIBの完全な名前を指定しないと、代わりに実装や、コンパイルの何か他のものを使用してみました。私はここで何をしないのですか?

Yole社:

Kotlin /ネイティブJavaライブラリをサポートしていません。あなたはマルチライブラリ(使用する必要がkotlinx.serializationなど)やネイティブライブラリをlibjson

おすすめ

転載: http://43.154.161.224:23101/article/api/json?id=222290&siteId=1