When I switched a project over to Java 11 (from 8 ...
# intellij
d
When I switched a project over to Java 11 (from 8 ) and converted to Gradle Kotlin DSL, I suddenly got a bunch of red underlines... I checked project structure dialog, couldn't find anything not 11... How do I configure gradle to get rid of all the red? The project actually compiles as-is...
m
I reverted to 8 ultimately
a
Check that you also have "File | Settings | Build, Execution, Deployment | Build Tools | Gradle | JVM" = Project SDK. Also might help: remove (rename) config and system IDEA directories (https://www.jetbrains.com/help/idea/tuning-the-ide.html#config-directory), remove cache from
~/.gradle
, remove .idea project directory and reimport the project.
d
OH... I had that on 1.8... I'll try now
Nope @Alexey Belkov [JB]... still all red, maybe I played around with my build script too much... I currently have this:
Copy code
tasks {
    withType<KotlinCompile>().configureEach {
        sourceCompatibility = JavaVersion.VERSION_11.toString()
        targetCompatibility = JavaVersion.VERSION_11.toString()

        kotlinOptions {
            jvmTarget = JavaVersion.VERSION_11.toString()
            useIR = true
        }

    }
}
Ok, last time I had to invalidate caches/restart, and then after a very long time of rebuilding all caches, it worked after that setting @Alexey Belkov [JB], but when I got to work today, the settings were back to their old values... and the red is back 🤒. Is there anything shorter to do than invalidate cache/restart?
I had to restart the IDE after changing the settings and erasing the
.idea/
folder, only then it gave me the option to re-import the project
😢~, it took less time than invalidating caches, but why doesn't it ask me when the files were erased?~
It goes back to java 8 after erasing the
.idea/
folder and re-importing... that's why it works. But it seems I can't change it to java 11.
Ok, it was trying to use the jvm of intellij's snap for 11... and that didn't seem to work.