---
title: "Unable to find a single main class from the following candidates"
author: "wangyanlong0107"
date: "2017-05-20T15:12:48Z"
tags: []
categories: ["开源软件"]
slug: "unable-to-find-a-single-main-class-from-the-following-candidates"
draft: false
lastmod: "2017-05-20T15:12:48Z"
id: 2375250
url: "https://bigdragon.iteye.com/blog/2375250"
---

\[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.2.7.RELEASE:repackage (default) on project kline-provider: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.2.7.RELEASE:repackage failed: Unable to find a single main class from the following candidates

 

错误原因：原来这个错误是因为maven在执行打包的时候会查找项目中的main方法，并设置为Spring boot 生成jar包的启动入口，但此时有多个main方法，maven插件就无所适从了。因此出现此异常。

因此，注释掉其他无用的main方法即可解决此问题。第一次碰到还是挺诡异的.