技术

mvn Unable to find main class

This post is currently available in Chinese only. The original text follows.Open the Chinese page →

mvn 出现Unable to find main class

因为我的项目采用的是多模块,子模块都是继承的parent的pom属性,而我其中的几个子模块作为公共类,是没有入口函数的,所以在没有入口函数的pom文件里面,不要放build的相关配置。

 ${project.artifactId}</finalname>
        ../result</directory>
        
           
                org.springframework.boot
                spring-boot-maven-plugin
            
       

也就是说在不需要打包出来的module的pom里面,不要有build的相关配置。而且如果父模块不需要打包的话,也不要在父模块里面加入打包的配置,不然所有继承父模块的子模块,都会进行打包

正确的做法是,只在需要打包的module里面配置build信息