Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.2.1.RELEASE:repac...

springboot项目有多个模块,在项目编译时报如下错误:

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.2.1.RELEASE:repackage (repackage) on project xxx: Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.2.1.RELEASE:repackage failed: Unable to find a single main class from the following candidates [xxx.xxxx.Class] -> [Help 1]
[ERROR] 

原因是项目的根pom.xml中配置了build:

    
        
            
                org.springframework.boot
                spring-boot-maven-plugin
            
        
        
            
                
                src/main/resources
                
                true
            
        
    

而项目中,不是所有的模块都是可以打包成可运行的JAR包,故引发了报错。
解决方案是,在编译报错的模块pom.xml中配置build:

    
        
            
                org.springframework.boot
                spring-boot-maven-plugin
                
                    true
                
            
        
    

再次编译则可顺利完成编译。

你可能感兴趣的:(Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.2.1.RELEASE:repac...)