Maven单独构建多模块项目中的单个模块

说明:

1、可能存在的场景,多模块项目没有互相引用,那么此时可以单独构建单个项目,指定到子模块的pom.xml文件即可完成编译。

2、如果多模块项目各自都引用了,那么单独编译子模块的pom.xml文件会直接报错,解决方法就是编译父项目pom.xml。

3、如果编译父项目,那么可能会造成编译时间很慢,其中有些项目也不需要编译,解决方法如下:

解决方法:

Maven选项:

-pl, --projects
        Build specified reactor projects instead of all projects
-am, --also-make
        If project list is specified, also build projects required by the list
-amd, --also-make-dependents
        If project list is specified, also build projects that depend on projects on the list

首先切换到工程的根目录

单独构建模块jsoft-web,同时会构建jsoft-web模块依赖的其他模块

mvn install -pl jsoft-web -am

单独构建模块jsoft-common,同时构建依赖模块jsoft-common的其他模块 

mvn install -pl jsoft-common -am -amd

 

参考:

http://blog.csdn.net/yanjunlu/article/details/39177115(以上内容转自此篇文章)

posted @ 2018-01-25 11:50  EasonJim  阅读(15447)  评论(0编辑  收藏  举报