在eclipse中,多模塊項目中單獨打包某個web工程時,選中 "resolve workspace artifacts" 會致使war包內依賴的其餘模塊的jar爲空目錄。 正確的打包某個模塊的方式是在parent工程上運行 Run As... > Maven Build...,在Goals中輸入:react
clean package -pl module_name -am
多模塊工程的打包命令參考:web
-am --also-make 同時構建所列模塊的依賴模塊; -amd -also-make-dependents 同時構建依賴於所列模塊的模塊; -pl --projects <arg> 構建制定的模塊,模塊間用逗號分隔; -rf -resume-from <arg> 從指定的模塊恢復反應堆。
看英文的更助於理解:eclipse
-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