SpringBoot打包报错Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.1.4.RELEASE

当不希望将SpringBoot打包成独立运行的jar,而只是当做工具jar包时,去掉启动类,打包报错:

Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.1.4.RELEASE:repackage (repackage) on project plat-common: Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.1.4.RELEASE:repackage failed: Unable to find main class -> [Help 1]

原因是SpringBoot使用了自动打包插件,会在打包时找项目下的启动程序

解决办法:
    去掉SpringBoot自带的自动打包插件

    使用Apache的打包插件

   
        org.apache.maven.plugins
        maven-compiler-plugin
       
            1.8
            1.8
       

   

你可能感兴趣的:(SpringBoot)