简体   繁体   English

JVM目标的Korge gradle设置

[英]Korge gradle setup for JVM target

I want to try the Korge libs on the JVM.我想在 JVM 上尝试 Korge 库。 I used the Korge IntelliJ plugin to create a new project.我使用 Korge IntelliJ 插件创建了一个新项目。 My build.gradle.kts looks like this :我的 build.gradle.kts 看起来像这样:

import com.soywiz.korge.gradle.*

buildscript {
  val korgePluginVersion: String by project

  repositories {
      mavenLocal()
      mavenCentral()
      google()
      maven { url = uri("https://plugins.gradle.org/m2/") }
  }
  dependencies {
      classpath("com.soywiz.korlibs.korge.plugins:korge-gradle-plugin:$korgePluginVersion")
  }
}

apply<KorgeGradlePlugin>()

korge {
  id = "amap3.amap3"
  targetJvm()
}

I've copied the commonMain code into the jvmMain folder and running the project with the runJvm command.我已将 commonMain 代码复制到 jvmMain 文件夹中,并使用 runJvm 命令运行项目。 I've looked into the examples on the korge doc and github, but i can't manage to solve the following silly question : If I have a java dependency from maven, let's say我查看了 korge doc 和 github 上的示例,但我无法解决以下愚蠢的问题:如果我有来自 maven 的 java 依赖项,假设

implementation("com.google.code.gson:gson:2.9.0")

where do I put it in this file ?我在哪里把它放在这个文件中?

Thank you very much for your attention非常感谢您的关注

I can't find the answer in the documentation either, but after going through the Gradle plugin source files, it appears that they are using the addDependency function in the korge {} block.我在文档中也找不到答案,但是在浏览了 Gradle 插件源文件之后,似乎他们正在使用korge {}块中的addDependency函数。 In your case it would look something like this:在您的情况下,它看起来像这样:

korge {
  id = "amap3.amap3"
  targetJvm()

  addDependency("jvmMainImplementation", "com.google.code.gson:gson:2.9.0")
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM