hi, i'm new in kotlin. ```Could not find method im...
# getting-started
m
hi, i'm new in kotlin.
Copy code
Could not find method implementation() for arguments [org.jetbrains.kotlin:kotlin-test-junit:1.5.21] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
What is this error mean and how to fix it? My build.gradle
Copy code
/*
 * This file was generated by the Gradle 'init' task.
 */

repositories {
    mavenCentral()
    maven {
        url = uri("<https://papermc.io/repo/repository/maven-public/>")
    }

    maven {
        url = uri("<https://oss.sonatype.org/content/groups/public/>")
    }

    maven {
        url = uri("<https://repo.maven.apache.org/maven2/>")
    }
}

dependencies {
    implementation("org.jetbrains.kotlin:kotlin-test-junit:1.5.21")
    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.21")
    implementation("io.github.monun:kommand-api:2.2.0")
    compileOnly("io.papermc.paper:paper-api:1.17.1-R0.1-SNAPSHOT")
}

java.sourceCompatibility = JavaVersion.VERSION_1_8

publishing {
    publications.create<MavenPublication>("maven") {
        from(components["java"])
    }
}

tasks.withType<JavaCompile> {
    options.encoding = "UTF-8"
}
a
Good morning, try changing
implementation("org.jetbrains.kotlin:kotlin-test-junit:1.5.21")
to
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:1.5.21")
🙂
m
ok
v
That shouldn't change anything, because what is missing is the applying of the Kotlin plugin. The Kotlin plugin (or one of its dependencies) "adds" the method it complains about.
⬆️ 2