I set up a compose-multiplatform project in Intell...
# compose-desktop
t
I set up a compose-multiplatform project in IntelliJ using its built-in template, and there's something wrong with the Gradle project it produces, or perhaps IntelliJ's integration: The source and test directories aren't marked as source and test, so I don't get Kotlin highlighting, completion, etc. I can manually mark them, but any Gradle reload undoes it. Interestingly, the resource directories are properly marked! Any tips?
I'm not too familiar with Gradle, unfortunately. If anyone would like to take a look, here's the repo, with essentially no modification after its initial templating: https://sandstorm.appux.com/shared/Ht7Wf-apel4_RH9SIg89fCJOjatSQb-AHLRSBUIP-xl/timmc/comp1337
i
It works fine with IntelliJ IDEA 2022.3.2 + Kotlin 1.8.20-dev-1103 IDEA plugin. Maybe you have outdated Kotlin plugin? Check its version.
t
Hmm... I'm on IntelliJ IDEA 2023.1 (CE) and my Kotlin plugin is apparently "231-1.8.20-IJ8109.175" whatever that means.
Perhaps there was a regression in the newer version.
(The bundled Gradle plugin is at 231.8109.175. I guess the "231" probably refers to 2023.1)
Here's what my sourceSets looks like -- just what the IntelliJ New Project template spits out.
Copy code
kotlin {
    jvm {
        jvmToolchain(11)
        withJava()
    }
    sourceSets {
        val jvmMain by getting {
            dependencies {
                implementation(compose.desktop.currentOs)
            }
        }
        val jvmTest by getting
    }
}
Full actual code here: https://sandstorm.appux.com/shared/Ht7Wf-apel4_RH9SIg89fCJOjatSQb-AHLRSBUIP-xl/timmc/comp1337/src/0d9388b76122a9f6c4ee0de878b14de5b641f7b0/build.gradle.kts -- the project works, but I have to manually mark those src and test dirs every time I start IntelliJ.
d
Can you please create minimal reproducible sample on GitHub? I will check your project with IDEA 2023.1 Also you may try to do this: In IntelliJ IDEA main menu: • File -> Invalidate Caches... -> Invalidate and Restart • Set all checkboxes • button "Invalidate and Restart"
Checked, it works fine:
t
Hmm! I deleted the .idea directory, did the invalidate & restart with all three checkboxes, re-opened the project... and no luck. Same "About" screen details as yours, except I'm on amd64.
But those template links you gave in the other thread were really helpful, thank you! Using the "desktop" version, I was able to fix the config so that IntelliJ loads it properly: https://sandstorm.appux.com/shared/Ht7Wf-apel4_RH9SIg89fCJOjatSQb-AHLRSBUIP-xl/timmc/comp1337/commit/3d886b9bfe799f3f0223e600f598479aa2c72fe0
It seems that IntelliJ's templating for the desktop version is making a multiplatform project instead, which is probably related somehow. (Even though I don't know why you're seeing a different result.)
(I do have to manually configure the JDK now, but I guess that's a tradeoff I'll take?)