2015年10月17日 星期六

[maven] profile 使用

最近專案在發佈的時候,需要把 war 檔案中的 config, jar 等檔案移出來的需求

看了一下 maven-war-plugin 的範例文件

把專案設定丟出來加些說明

1. 在 pom.xml 裡面增加 profiles 不同的 profile 可以適用不同環境的上版參數設定

2. profile 裡面主要有三個 plugin,設定大概如下方說明

3. mvn clean install -Dmaven.test.skip=true -Puat

-P 就是指定 profile 的意思

Eclipse version


threads 跟 skip Tests 都是自己加的 不需要可以自己移掉


--- plugin 示意

  •  maven-war-plugin : 
    • 處理 war 檔案包裝,包括檔案過濾、web.xml 指定、其他資源載入等
  • maven-compiler-plugin
    • java 編譯相關參數,設定編譯用參數,顯示提示等
  • maven-resource-plugin
    • 將設定檔案移動至指定位置