提示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>