如何告诉Spring Boot哪个主类用于可执行jar? [英] How do I tell Spring Boot which main class to use for the executable jar?

查看:140
本文介绍了如何告诉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 Maven插件它应该用哪个类作为主类?

My project has more than one class with a main method. How do I tell the Spring Boot Maven plugin which of the classes it should use as the main class?

推荐答案

添加你的开始类在你的pom中:

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>

这篇关于如何告诉Spring Boot哪个主类用于可执行jar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆