Unable to find a single main class from the following candidates [app.datapool.util.AESUtil, app.dat

Unable to find a single main class from the following candidates [app.datapool.util.AESUtil, app.datapool.util.SimilarityRatioUtils, app.datapool.util.UUIDUtil]

报错原因分析:


在使用maven对项目中的某个模块执行mvn package命令,或是mvn install命令时,出现如上错误, 根据错误提示,应该是该模块下 , 出现了多个main方法, 根据maven打包规则, 一个模块下只能有一个main方法, 由于我咋测试工具类时,手动创建了多个main方法, 对类进行了测试,导致模块当中出现了多个main方法, 

解决方式一:

删除多余的main方法, 保留一个main方法就可以了, 注意不能把main方法全部删除 , 不然会出现入下错误

Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.1.3.RELEASE:repackage (repackage) on project core: Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.1.3.RELEASE:repackage failed: Unable to find main class

解决方式二:

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

在pom.xml中指定启动类

猜你喜欢

转载自blog.csdn.net/qq_27348837/article/details/104355677