16

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?

1
  • 7
    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/issues Commented Mar 8, 2023 at 8:29

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.