Unable to find a single main class from the following candidates [Xxx, Yyy, Zzz]

时间:2025-03-21 09:16:51

Failed to execute goal :spring-boot-maven-plugin:2.1.:repackage (repackage) on project common: Execution repackage of goal :spring-boot-maven-plugin:2.1.:repackage failed: Unable to find a single main class from the following candidates [, , .base64.Base64Tool, , , .Md5Util]

意思是说:从下面的候选类[Xxx, Yyy, Zzz]中找到了很多main运行类。

解决办法:

1、查看着两个类,发现两个类中确实两个类中均有一个main方法,去掉一个多余的main方法,保留唯一的main方法。

2、把这个去掉,包括父工程的、自己项目的

        <plugins>
            <plugin>
                <groupId></groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>

3、加一个Springboot启动类

@SpringBootApplication
public class ManagerApplication {

    public static void main(String[] args) {
        (, args);
    }

}