Skip to content
Advertisement

Korge gradle setup for JVM target

I want to try the Korge libs on the JVM. I used the Korge IntelliJ plugin to create a new project. My build.gradle.kts looks like this :

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. 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

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

where do I put it in this file ?

Thank you very much for your attention

Advertisement

Answer

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. In your case it would look something like this:

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

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