參考:Triggering build twice for each commit
這問題困擾我蠻久的,就是每一次當我svn commit後呼叫post-commit 執行jenkins build的時候,『第一次』也就是由post-commit執行的那次jenkins build,總是無法取到最新的svn更新版本,一定要手動執行jenkins build才可以成功抓到svn最新版本。
專案小的時候還無所謂,但隨者專案越來越大,且每一次build都還要執行unitTest的情況來說,每次的小修改,都要花上3~5分鐘(執行兩次build)才能build到最新版本開始測試,實在是很累。
後來找到上述討論,似乎與time sync有關(不太明白為什麼),我用了討論串中最簡單的方式,也就是在jenkins build的組態中將svn url後面加上@HEAD的參數,解決了此問題。
另一點奇怪的是,我有兩個專案,在一開始都沒這種問題,都是用到後面才開始出現.....
2014年7月5日 星期六
2014年4月30日 星期三
ANT - build junit時出現Errors while applying transformations: Fatal error during transformation...
今天播點時間來實作『一年前』(沒錯...我拖了一年...)上課學習的東西,將我的TestCase搬到Jenkins上,並安裝emma plugin觀看Junit Testing Report,
首先第一件事情當然是要寫一個ANT Build,但執行的時候出現以下錯誤:
[junitreport] Processing /Users/wuanne/workspace/eclipse/XXXXTest/build/junitReport/TESTS-TestSuites.xml to /var/folders/59/jk74nmqj48n_6wksbv0lccw80000gn/T/null1033290394
[junitreport] Loading stylesheet jar:file:/Applications/eclipse/plugins/org.apache.ant_1.8.4.v201303080030/lib/ant-junit.jar!/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl
[junitreport] : Error! 非靜態 Java 函數 'replace' 的第一個引數不是有效的物件參照。
[junitreport] : Error! 無法編譯樣式表
[junitreport] : Fatal Error! 無法轉換 data-type 'void' 為 'reference'。 Cause: 無法轉換 data-type 'void' 為 'reference'。
[junitreport] Failed to process /Users/wuanne/workspace/eclipse/XXXXTest/build/junitReport/TESTS-TestSuites.xml
BUILD FAILED
/Users/wuanne/workspace/eclipse/XXXXTest/build/build.xml:90: Errors while applying transformations: Fatal error during transformation
報錯的build.xml:90為:
<target name="junit-report">
<junitreport todir="${junitReport.dir}">
...
</target>
當然這行看起來實在沒什麼問題,google了一下,參考上述討論網站的解答:
不要使用eclipse自帶的ANT,自行安裝ANT,並在eclipse->preference->Ant->Runtime,按下『Ant Home』設定自行安裝的ANT,重新build,就可以成功了~
訂閱:
文章 (Atom)