Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.0.1.RELEASE:repackage failed: Unable to find a single main class from the following candidates
我的项目有多个使用main方法的类。如何告诉Spring Boot Maven插件应将其用作主类?
main
Add your start class in your pom:
<properties> <!-- The main class to start by executing java -jar --> <start-class>com.mycorp.starter.HelloWorldApplication</start-class> </properties>
or
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <mainClass>com.mycorp.starter.HelloWorldApplication</mainClass> </configuration> </plugin> </plugins> </build>
对于使用Gradle(而不是Maven)的用户:
springBoot { mainClass = "com.example.Main" }