多模塊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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章