How to avoid VS Code warning: “[myfile].java is a non-project file, only syntax errors are reported”

后端 未结 4 2674
渐次进展
渐次进展 2021-01-05 17:37

I am running a build task in a java project in Visual Studio Code. The warning in the "PROBLEMS" tab:

[myfile].java is a non-project file, only

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-05 17:48

    I got the same warning as well. It was simply because I had two Java projects in the same vscode workspace. Once I've moved projA out of the workspace, the warning for projB is gone.

    WorkspaceRoot
    │   projectA
    └───projectB
    

    At this point, I think the most likely solution is to have one Java (Maven) project for one workspace. Otherwise I guess vscode will treat they all as one project and they'll interfere with each other.

提交回复
热议问题