Unrecognised dependency notation
Asked Answered
P

0

13

I have a multi-project Kotlin project in IntelliJ IDEA. It compiles and runs fine, both from the IDE and from the console. However, there's a problem with my gradle files: the IDEA complains about "Unrecognised dependency notation" as well as other kinds of errors.

Here's one of the sub-project build.gradle files:

apply plugin: 'org.jetbrains.kotlin.jvm'
apply plugin: 'application'

sourceSets {
    main {
        java.srcDirs "src/java"
    }
}

java {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_1_8
}

test {
    useJUnitPlatform()
}

jar.dependsOn test

dependencies {
    implementation platform('org.jetbrains.kotlin:kotlin-bom')

    // All of the following lines show errors:
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4"
    testImplementation "org.jetbrains.kotlin:kotlin-test"
    testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1'
}

This is annoying, because that way, I can't see if the libraries I use are outdated.

Also, some of the gradle tasks are not properly recognised even though they run fine:

screenshot

I have no idea why outputs, outputDir and doFirst are greyed out in the screenshot above.

I tried gradle sync, "Invalidate caches and restart", "Repair IDE", and even reimporting the project, to no avail. Any ideas what's happening here?

Presa answered 8/3, 2023 at 7:49 Comment(1)
This seems an IDEA issue. Try File | Invalidate Caches | Invalidate and Restart from the main menu to see if it helps. If not, you could create a bug report here to report this problem: youtrack.jetbrains.com/issuesGallous

© 2022 - 2024 — McMap. All rights reserved.