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
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.