IntelliJ无法读取任何与Maven相关的导入或类。

huangapple go评论85阅读模式
英文:

Intellij is not able to read any Maven related imports or classes

问题

我有一个Spring Boot Maven项目。当我使用clean、verify、install命令构建项目时,构建成功。稍后当我运行Tomcat时,它在本地也成功部署。但它无法识别与Java相关的导入和类。
整个项目都变成了红色。我不知道我错过了什么。当我进入Maven依赖项时,我看到它们好像被锁定了。分享截屏

IntelliJ无法读取任何与Maven相关的导入或类。

IntelliJ无法读取任何与Maven相关的导入或类。

英文:

I have a spring boot maven project. When I build the project with clean, verify, install command. It's a successful build. And later when I run tomcat, it gets successfully deployed as well locally. But it is not able to recognise java related imports and classes.
The whole project is painted red. I don't know what did I miss. When I go to the maven dependencies, I see as if they are being locked. Sharing screenshots

IntelliJ无法读取任何与Maven相关的导入或类。

IntelliJ无法读取任何与Maven相关的导入或类。

答案1

得分: 0

看起来对我来说,您在IntelliJ中没有设置正确的项目SDK(Java JDK)。您可能想查看 File > Project Structure > Project > SDK

英文:

It looks to me like you didn't set up a proper Project SDK (Java JDK) in IntelliJ. You might want to have a look at that File > Project Structure > Project > SDK

答案2

得分: 0

我找到了一个解决方案。在互联网上找不到任何有效建议之后,我就一直在设置中徘徊。转到首选项-->编辑器-->文件类型。

检查是否包含了 *.java 作为 Java 的文件类型。
检查是否包含了 *.class 作为 Java 类的文件类型。

如果不存在,添加它们。这样就会开始起作用。

英文:

I found a solution. After nothing recommended all over the internet did not work. I just kept wandering in settings. Go to Prefernces--->Editor--->FileTypes

Check java has *.java included
Check Java Class has *.class included

Add them if not present. It will start working.

huangapple
  • 本文由 发表于 2020年4月7日 20:31:06
  • 转载请务必保留本文链接:https://go.coder-hub.com/61080088.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定