使用 java: Create Java project 创建了一个新的demo,发现java功能一切正常了,并且我我将原项目的所有代码拷贝过来也能正常使用
https://code.visualstudio.com/docs/java/java-project
Import Java projects
You can directly import existing Java projects and modules to your workspace through File > Open Folder… (Make sure the opened >folder contains your build tool scripts, for example, pom.xml or build.gradle). VS Code for Java will detect your projects and import > > them automatically.
When you add a new module into your projects, you can trigger the command Java: Import Java projects in workspace to import >them to your workspace. This command helps to import new projects into the workspace without the need to reload the VS Code window
vscode官方介绍也说了,只要你的项目里面有pom.xml,就能自动识别,所以这边也看不出来问题出现在哪里
还是怀疑是vscode项目缓存的问题,尝试在命令面板中执行 “Java: Clean the Java language server workspace” 命令,但是没有起效果。
但是我不死心,
vscode应该会缓存之前打开过的项目,导致项目状态识别有问题
【期望你能愉快的看到这个窗口】