springboot项目打包提示Unable to find a single main class from the following candidates错误

提示Unable to find a single main class from the following candidates错误的原因是会从所有代码里面扫描包括main方法的类,找到多个类就报错了。

解决办法是在pom.xml指定启动的类:

    <properties>
        <start-class>com.corp.MyApplication</start-class>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>

 

posted @ 2018-02-06 15:22  魔豆  阅读(1422)  评论(0编辑  收藏  举报