Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can not find PsiClass in my Intellij plugin project

screenshot in my project

Many tutorials mention a class - PsiClass, but I can't find this class in my project. My build.gradle as below:

plugins {
    id 'java'
    id 'org.jetbrains.intellij' version '0.4.16'
    id 'org.jetbrains.kotlin.jvm' version '1.3.61'
    id 'idea'
}

apply plugin: "org.jetbrains.intellij"
apply plugin: 'java'
apply plugin: 'idea'

group 'com.github.boybeak.adapter'
version '0.1'

sourceCompatibility = 1.8

repositories {
    /*google()
    jcenter()*/
    mavenCentral()
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
//    implementation group: 'com.github.boybeak', name: 'any-adapter', version: '1.1.2'
    testCompile group: 'junit', name: 'junit', version: '4.12'
}

intellij {
    /*version '192.7142.36'*/
    type 'AI'
    plugins 'android'
    localPath '/Applications/Android Studio.app'
}

My IDEA version:

IntelliJ IDEA 2019.3.1 (Community Edition) Build #IC-193.5662.53, built on December 18, 2019 Runtime version: 11.0.5+10-b520.17 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o macOS 10.15.3 GC: ParNew, ConcurrentMarkSweep Memory: 990M Cores: 4 Registry: Non-Bundled Plugins: DBN, OdpsStudio, no.tornado.tornadofx.idea

Should I add some more libraries in my project?

like image 602
boybeak Avatar asked Nov 02 '25 07:11

boybeak


2 Answers

After a little more searching, I find a solution. https://intellij-support.jetbrains.com/hc/en-us/community/posts/360005055559-Missing-classes-after-upgrade-to-2019-2-2

Change my Gradle like this:

intellij {
    /*version '192.7142.36'*/
    type 'AI'
    plugins 'android', 'java'
    localPath '/Applications/Android Studio.app'
}

Add Java plugin after android

like image 84
boybeak Avatar answered Nov 04 '25 18:11

boybeak


I was able to fix this by adding this to the build.gradle.kts file:

intellij {
    version.set("2021.3.3")
    type.set("IC") // Target IDE Platform

    plugins.set(listOf("com.intellij.java")) // Add this
}

When I did that, this little guy popped up:

enter image description here

I clicked on that and then I was able to import the PsiClass.

like image 39
Joe Muller Avatar answered Nov 04 '25 20:11

Joe Muller