Unable to find a single main class from the following candidates

使用Spring boot + maven模式進行開發,執行maven命令中的package仍是install,都會出現如下異常spring

命令:apache

mvn clean package -Dmaven.test.skip=truemaven

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.4.0.RELEASE:repackage (default) on project renpro: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.4.0.RELEASE:repackage failed: Unable to find a single main class from the following candidates [com.ren.RenProApplication, com.ren.util.StrMd5] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

錯誤緣由:原來這個錯誤是由於maven在執行打包的時候會查找項目中的main方法,並設置爲Spring boot 生成jar包的啓動入口,但此時有多個main方法,maven插件就無所適從了。所以出現此異常。spring-boot

所以,註釋掉其餘無用的main方法便可解決此問題。插件

相關文章
相關標籤/搜索