1. 程式人生 > 實用技巧 >maven 單獨構建多模組專案中的單個模組

maven 單獨構建多模組專案中的單個模組

最近在公司的一個專案裡用到了maven的多模組,由於專案比較大,每次修改後構建整個工程耗時太久,需要單獨構建某個模組,mvn有支援的選項:

  1. -pl, --projects
  2. Build specified reactor projects instead of all projects
  3. -am, --also-make
  4. If project list is specified, also build projects required by the list
  5. -amd, --also-make-dependents
  6. If project list is specified, also build projects that depend on projects on the list

首先切換到工程的根目錄,

單獨構建模組 pingjuan-web,同時會構建 pingjuan-web 模組依賴的其他模組

$ mvn install -pl pingjuan-web -am

單獨構建模組 pingjuan-common,同時構建依賴模組 pingjuan-common 的其他模組

$ mvn install -pl pingjuan-common -am -amd

轉載:https://blog.csdn.net/yanjunlu/article/details/39177115?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-9.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-9.channel_param