Use Maven command Spring-Boot: Run Start the SpringBoot project to report an error:
Unable to find a suitable main class, please add a ‘mainClass’ property
First of all, I can determine that I have no mistake. I can start the project through the Java class, but the Spring-Boot: RUN command cannot start the project.
1 First, add the POM configuration file plug -in setting according to the online suggestion:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!-Add the following->
<configuration>
<mainClass>class_name</mainClass>
</configuration>
</plugin>
</plugins>
</build>
I have no effect after trying it
2 first start the SpringBoot project through the Java class
@SpringBootApplication
public class App {
public static void main(String[] args) {
SpringApplication.run(App.class, args);
}
}
can be successfully started and keep starting status
execute Spring-Boot: Run command starts, the Spring icon will appear, but the error will be reported afterwards
At this time, turn off the threads startup of the Java class, and then execute the Spring-Boot: Run command to start.
This is how I started this.