在Intellij IDEA生成的kotlin本机项目中,应将gradle依赖项块放在哪里? [英] Where to put gradle dependencies block in kotlin native project generated by Intellij IDEA?

查看:563
本文介绍了在Intellij IDEA生成的kotlin本机项目中,应将gradle依赖项块放在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试用Kotlin Native制作我的第一个应用程序.我想将TornadoFX添加到我的新创建的项目中. 我需要根据 TornadoFX指南添加依赖项/a>

I'm trying to make my first app in Kotlin Native. I want to add TornadoFX to my freshly created project. I need to add a dependency according to TornadoFX guide

dependencies {
    compile 'no.tornado:tornadofx:x.y.z'
}

问题是-我无法弄清楚我应该把它放在哪里.

这是我的build.gradle内容(由IntelliJ IDEA生成):

This is my build.gradle contents (generated by IntelliJ IDEA):

plugins {
    id 'org.jetbrains.kotlin.multiplatform' version '1.3.60'
}
repositories {
    mavenCentral()
}
kotlin {
    // For ARM, should be changed to iosArm32 or iosArm64
    // For Linux, should be changed to e.g. linuxX64
    // For MacOS, should be changed to e.g. macosX64
    // For Windows, should be changed to e.g. mingwX64
    mingwX64("mingw") {
        binaries {
            executable {
                // Change to specify fully qualified name of your application's entry point:
               entryPoint = 'sample.main'
                // Specify command-line arguments, if necessary:
                runTask?.args('')
            }
        }
    }
    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 {
        }
    }
}

// Use the following Gradle tasks to run your application:
// :runReleaseExecutableMingw - without debug symbols
// :runDebugExecutableMingw - with debug symbols

我尝试过的地方:

1.顶级

> Could not find method compile() for arguments [no.tornado:tornadofx:1.7.19] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

2.在Kotlin {}

> Could not find method compile() for arguments [no.tornado:tornadofx:1.7.19] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

3.在mingwMain {}内部

> Could not find method compile() for arguments [no.tornado:tornadofx:1.7.19] on object of type org.jetbrains.kotlin.gradle.plugin.mpp.DefaultKotlinDependencyHandler.

此外,当放入mingwMain内时,编译行会突出显示并带有提示'compile' cannot be applied to '(java.lang.String)'

Also, when put inside mingwMain, the compile line gets highlighted with a notice 'compile' cannot be applied to '(java.lang.String)'

推荐答案

As it was pointed out by this comment we cannot use TornadoFX in Kotlin Native, so I was doing everything wrong since the beginning, and this is not really a gradle issue.

这篇关于在Intellij IDEA生成的kotlin本机项目中,应将gradle依赖项块放在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆