1. 子模块必须是jar才行
<packaging>jar</packaging>
  1. 子模块打包添加下面的打包配置
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<classifier>exec</classifier>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>

true 是跳过main函数(因为子模块没有main函数)