SpringBoot modify the project package name, start the project prompt: Error: Could not find or load main class xxx.xxx.xxxApplication

I'm going to write a project with the same architecture in the near future, so in order to save trouble, I directly changed the name of the original project and the package name of the project is directly a system, which is simply beautiful. When everything is ready, start to run the project, and then the console reports an error:

Error: Could not find or load main class xxx.xxx.xxxApplication

-Tried methods: Because the project is multi-module, it prompts that no other modules can be found after refactoring the project; then use Maven to clean, and then click to run the same error, which is puzzling, and finally in Stack Overflow Found a solution on:

1. Open the .idea folder and delete it  workspace.xml . When the deletion is complete, the system will automatically generate it (recommended).

2. If the above method does not work, delete the entire .idea folder, and then restart the import project (when the first method does not work, use it).

- the problem: Because IDEAgenerates custom configuration for each project, all the configuration information will be stored in a  workspace.xml folder, when we changed the package name or project name when the project, IDEA from  workspace.xml reading to or The configuration information of the previous project, so it led to the problem of not being able to find the startup class.

Guess you like

Origin blog.csdn.net/peng2hui1314/article/details/106176142