多模块Maven工程单独打包某一模块工程
在eclipse中,多模块项目中单独打包某个web工程时,选中 "resolve workspace artifacts" 会导致war包内依赖的其他模块的jar为空目录。 正确的打包某个模块的方式是在parent工程上运行 Run As... > Maven Build...,在Goals中输入:
clean package -pl module_name -am
多模块工程的打包命令参考:
-am --also-make 同时构建所列模块的依赖模块;
-amd -also-make-dependents 同时构建依赖于所列模块的模块;
-pl --projects <arg> 构建制定的模块,模块间用逗号分隔;
-rf -resume-from <arg> 从指定的模块恢复反应堆。
看英文的更助于理解:
-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
-pl,--projects <arg>
Comma-delimited list of specified reactor projects to build instead of all projects. A project can be specified by [groupId]:artifactId or by its relative path.
-rf,--resume-from <arg>
Resume reactor from specified project
参考:https://blog.sonatype.com/2009/10/maven-tips-and-tricks-advanced-reactor-options/#.VpdK9Nwaa6M
https://yuzhouwan.com/posts/2254/