vs code - Expected java package name error

后端 未结 4 1502
名媛妹妹
名媛妹妹 2021-01-17 20:05

I have a java project with the following directory structure (as required by Gradle\'s \'java\' plugin, assuming all defaults).

projectRootDir
          


        
相关标签:
4条回答
  • 2021-01-17 20:30

    In my case, the problem was faustinoaq.javac-linter extension. I uninstall the linter extension and everything works.

    0 讨论(0)
  • 2021-01-17 20:37

    To get things right, add the root folder of you project in workspace. To do this in VS Code, go to File -> "Add folder to workspace" and then select the root folder (source folder).

    0 讨论(0)
  • 2021-01-17 20:43

    If your files are already in the correct directory, press F1 and type in "Clean the Java Language Server Workspace"

    0 讨论(0)
  • 2021-01-17 20:50

    Because vscode set the src folder as the default Java Source Path, you should change it to folder src/main/java. Just right click the folder src/main/java in vscode and click the option Add Folder to Java Source Path, then reopen the file, and the error is gone.

    0 讨论(0)
提交回复
热议问题