Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.6k views
in Technique[技术] by (71.8m points)

idea升级2020.3以后,编译插件以后提示“类文件具有错误的版本”

image.png

如题,错误信息文本为:

错误: 无法访问NotificationDisplayType
import com.intellij.notification.NotificationDisplayType;
                                ^
  错误的类文件: /Users/formalin14/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/ideaIC/2020.3/22cef0fc611e4b9642a48bc955b2b7aacb13bd4d/ideaIC-2020.3/lib/platform-api.jar(com/intellij/notification/NotificationDisplayType.class)
    类文件具有错误的版本 55.0, 应为 52.0
    请删除该文件或确保该文件位于正确的类路径子目录中。

build.gradle 里使用的是 0.6.5和2020.3:

plugins {
 id 'java'
//    id 'org.jetbrains.intellij' version '0.5.0'
 id 'org.jetbrains.intellij' version '0.6.5'
}

intellij {
 version = '2020.3'
 plugins = ['java']
}

请问有人遇到过吗?怎么解决的,这个类文件怎么还有版本呢?会不会跟idea下载预编译索引有关?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

解决了,原来是 idea 2020.3 版本采用了 jdk 11,所以它的类都是用 jdk 11 编译的。我把插件项目的 jdk 改成 jdk 11 以上,就好了。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...