1.在父模块上右键new->module
2.按照需求创建子模块,最后位置选在父模块路径下(我的父模块为traffic-master)
3.修改父模块的pom文件
(1) 添加子模块
<modules>
<module>traffic-api</module>
</modules>
(2)指定打包方式
<packaging>pom</packaging>
3.修改子模块pom文件
将子模块的<parent>修改为父模块信息
<parent>
<groupId>cn.tian</groupId>
<artifactId>traffic-master</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
4.将模块中<parent>属性中<relativePath>删掉
下图为将不需要的文件删除后的项目结构: