Home > database >  unsolved reference: KorgeGradlePlugin at apply<KorgeGradlePlugin>()
unsolved reference: KorgeGradlePlugin at apply<KorgeGradlePlugin>()

Time:08-26

Has anyone experienced unresolved reference in build.gradle.kts?

My codes were:

import com.soywiz.korge.gradle.*

buildscript {
repositories {
    mavenLocal()
    maven { url = uri("https://plugins.gradle.org/m2/")}
    mavenCentral()
}

dependencies {
    classpath("com.soywiz:korge-gradle-plugin:2.7.0")
}

apply<KorgeGradlePlugin>()

korge {
      id = "mycode"
      targetJvm()
}}

I'm using IntelliJ Ultimate 2022.2 on MacBook Pro M1. Korge version is 3.0.0 and Kotlin version 222-1.7.10-release-334-IJ3739.54.

Please help, thanks.

CodePudding user response:

The Korge documentation seems to be a little bit outdated.

You can use a Gradle plugin by adding it to the plugins block, like so:

plugins {
    id("com.soywiz.korge") version "3.0.0"
}

The version can be found on mvnrepository.com, and I found the id by looking at the build.gradle.kts in their plugin source code.

There's a difference between a Gradle plugin and loading a dependency via gradle. The plugins should be loaded via the id and version in the plugins block, and usually don't require anything in the dependencies block. A plugin then only provides a DSL to use in your build.gradle. When you specify something in the dependencies block, that's a dependency of your source code.

  • Related