使用maven打包指定mainClass


        
            
                org.springframework.boot
                spring-boot-maven-plugin
                
                    com.xxx.XxxApplication
                
                
                    
                        
                            repackage
                        
                    
                
            
        
    

SpringBoot Maven打包错误及原因

1.org.springframework.boot:spring-boot-maven-plugin:2.2.1.RELEASE:repackage failed: Unable to find main class

2.找不到符号

Unable to find main class 问题原因

如果使用SpringBoot打包插件如下


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

Springboot怎么使用maven打包指定mainClass

一个项目有多个main.class,导致打包时maven不知道使用哪一个为主入口,这里我们需要设置


 
   
     org.springframework.boot
     spring-boot-maven-plugin
     
      	com.demo.springboot.DemoSbApplication
     
   
 

找不到符号问题原因

这个原因一般是我们在打包时,打包项目是打jar包,又引用了其他module。

而其他module没使用jar方式打包,对于springboot来说就是设置了pom,这种肯定是找不到类,所以我们只要设置那个module的打包方式为jar就可以了。注意:这里有可能引发Unable to find main class问题。

本文转载于:https://www.yisu.com/zixun/785265.html 如有侵犯,请联系zhengruancom@outlook.com删除。
免责声明:正软商城发布此文仅为传递信息,不代表正软商城认同其观点或证实其描述。