1. 程式人生 > >RTC與Maven Release Plugin結合使用遇到的問題

RTC與Maven Release Plugin結合使用遇到的問題

在Maven的網站有關於如何使用Jazz scm plugin來實現自動release的文章(Jazz Release),我這裡不做囉嗦,主要說一下,按照這個使用後遇到的問題以及如何解決的。

  1. 檔案結構問題,在我們的系統設計之初,在RTC中建立了3個components,3個maven project來獨立構建3個ear,後來為了一次性構建3個ear,建立了第四個component (build)專門儲存pom.xml和settings.xml。結構如下:
    component1
    project1
    component2
    project 2
    component3
    project 3
    component4
    build project
    pom.xml, settings.xml
    所以在改進之後我們的maven命令都是在bui ld 目錄下進行的。這個時候我們在build專案中的pom.xml加入瞭如下配置:
   <scm>             <connection>scm:jazz:https://rtc:9444/jazz:GPDBBuildWorkspace</connection>
    </scm>

結果在從執行mvn release:prepare的時候,發現tag scm之後,pom.xml裡面的connection變成了

 <scm>        <connection>scm:jazz:https://rtc:9444/jazz:GPDBBuildWorkspace/jazz:tag-version</connection>
</scm>

這個在標準maven project中沒有出現過,標準scm tag之後會變回之前配置的額workspace。這個問題的細節我沒有研究,看到官方文件這句之後:It is very strongly recommended that a separate repository workspace, containing just one component, the component to be released, be set up for exactly this purpose. 把專案在rtc的結構重構解決問題。解決之後的檔案結構
component5
project1
project 2
project 3
pom.xml
settings.xml

  1. 沒有自動Push,這個問題只發生在我本地的機器上,覺得非常奇怪。查看了scm plugin的程式碼,發現是系統platform encoding不同導致的,Push之前會讀取現在的baseline和workspace資訊比較,用的是簡單的string parse,沒有考慮utf問題,所以只有最後通過修改scm.ini解決。
-Duser.language=us -Dfile.encoding="UTF-8"
  1. Push遇到changset should be associate with artifact id,這個問題可以參考scm775MRELEASE-909,本以為這個問題已經解決了,可惜Chris提交的程式碼錯過了scm相關的release,現在也沒有看到Chris release的跡象,沒辦法只能把相關的Git程式碼弄到本地,建立自己的Local版本,將release plugin和scm plugin放到本地repo中。
    release plugin 版本定製:
    a. 在release plugin的git版本中下載當前版本zip包
    b. 將Chris改的release相關程式碼合併到zip包版本中
    c. 用mvn:install -DskipTests=true在target資料夾中獲取對應的release包
    scm plugin版本定製:
    a.在scm plugin的git版本中下載1.9.4版本zip包
    b.將Chris改動的程式碼合併到zip包版本中
    c. 用mvn:install -DskipTests=true在target資料夾中獲取對應的release包
    在settings.xml建立自己的local plugin repo,把scm plugin和release plugin的定製版放到專案source control下,把local plugin repo指向定製版scm和release plugin,搞定。