Cannot access class 'com.intellij.openapi.module.Module'. Check your module classpath for missing or conflicting dependencies

Answered

Gradle Idea plugin project

plugins {
id("org.jetbrains.intellij") version "1.2.0"
kotlin("jvm") version "1.5.31"
}

group = "org.example"
version = "1.0-SNAPSHOT"

// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
version.set("2021.2.3")
type.set("IU")
downloadSources.set(true)
plugins.set(arrayListOf("SpringMvc", "java", "Kotlin", "Spring", "lombok"))
}
repositories {
mavenCentral()
}

dependencies {
implementation(kotlin("stdlib"))
}

 

0
3 comments

Unfortunately, Gradle IntelliJ Plugin v1.2.0 contains a regression issue that prevents providing SDK sources to the IDE (however, it works well in compilation time).

This issue is fixed with v1.2.1.

0

The same issue is still exists with v1.3.0

id("org.jetbrains.intellij") version "1.3.0"

 

org.jetbrains.kotlin.idea.caches.project.MultiplatformUtilKt#isTestModule

0

I can confirm that the 1.3 version didn't solve this. My Gradle config file is almost the same as posted above.

Build, running the IDE works great. Loading and working with Kotlin PSI classes also works. Some IntelliJ-PSI also loads, but some others don't:

  • In KtElement, loading com.intellij.psi.NavigatablePsiElement fails
  • Calling accept on a KtNamedFunction
  • equalsToken of a org.jetbrains.kotlin.psi.KtProperty
  • references of a org.jetbrains.kotlin.psi.KtNameReferenceExpression

However, accepting only IntelliJ-PSI and only Kotlin-PSI separately works fine. So yeah, the dependency between them don't match.

Another problem which relates to this one I think is that when opening a file which has this kind of error makes the IDE pretty much unusable. Not only syntax highlighting, suggestion etc won't work, but for me it also causes 1-4 minutes 60-90% CPU usage all the time I edit anything (ie. just add a new line) in the file. I think it tries to resolve the dependencies again and again, but fails all the time. If I open another file that don't contains any PSI reference nor errors, re-analyzing the Kotlin file, as well as other IDE-features works perfectly.

0

Please sign in to leave a comment.