英文:
Intellij is not able to read any Maven related imports or classes
问题
我有一个Spring Boot Maven项目。当我使用clean、verify、install命令构建项目时,构建成功。稍后当我运行Tomcat时,它在本地也成功部署。但它无法识别与Java相关的导入和类。
整个项目都变成了红色。我不知道我错过了什么。当我进入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
答案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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论