When I create any project in SpringBoot the project appears an error saying the following: "Could not locate or load the main class". However, when I run any other old project it works normally.
You might have had an issue the first time and your local jar could be borked, so it looks like your .m2 dependencies has downloaded incorrectly.
Execute mvn dependency:purge-local-repository
to delete your local repository and then execute mvn clean package