如何告诉Spring Boot可执行jar使用哪个主类?
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" title="Spring Boot">Spring Boot Maven插件应将其用作主类?
回答:
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>
以上是 如何告诉Spring Boot可执行jar使用哪个主类? 的全部内容, 来源链接: utcz.com/qa/410257.html