• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • 持續集成 Java手冊

    發表于:2007-07-04來源:作者:點擊數: 標簽:
    持續集成 Java 手冊 一、概念 Martin Fowler的文章:Continuous Integration 中文翻譯:持續集成 二、工具 傳統工具:VisualStudio.Net,Visual SourceSafe , Rational ClearCase 自動編譯工具:Ant 回歸測試工具:JUnit 代碼檢查工具:CheckStyle 持續集成
    持續集成 Java手冊
    一、概念
    Martin Fowler的文章:Continuous Integration 中文翻譯:持續集成

    二、工具
    傳統工具:VisualStudio.Net,VisualSourceSafe,Rational ClearCase

    自動編譯工具:Ant

    回歸測試工具:JUnit

    代碼檢查工具:CheckStyle

    持續集成工具:CruiseControl

    三、步驟
    CruiseControl監控遠程版本控制系統的變化

    變化發生時CruiseControl調用編譯工具進行編譯(Ant等)

    編譯成功后調用JUnit進行回歸測試

    編譯成功后調用CheckStyle進行代碼檢查

    完畢后將編譯結果、測試結果、代碼檢查結果發送至開發人員、主管經理,并發布至網站,甚至報警器

    所有這一切都是按照編制好的腳本自動進行的

    四、實施示例
    目前我們使用的是ClearCase,主控軟件為CruiseControl,其腳本文件為cccc.xml

    配置遠程版本控制系統

    <modificationset quietperiod="30">
    <clearcase branch="main" viewpath="D:\cc_view\chelseafc\Nucleus2.0\Port" recursive="true" />
    </modificationset>
    配置編譯工具

    <schedule interval="30">
    <ant antscript="C:\Java\JBuilder2005\thirdparty\ant\bin\ant.bat" buildfile="D:\cc_view\chelseafc\Nucleus2.0\Port\clearcase-build.xml" target="cleanbuild" multiple="1" />
    </schedule>
    配置測試用例(在ant的配置文件中)

    <target name="test" depends="init" description="Run unit tests">
    <delete dir="${junit.results}" />
    <mkdir dir="${junit.results}" />
    - <junit fork="yes" haltonfailure="yes">
    - <classpath>
    <pathelement location="${build.dir}" />
    </classpath>
    <formatter type="plain" usefile="false" />
    <formatter type="xml" />
    - <batchtest todir="${junit.results}">
    <fileset dir="${build.dir}" includes="**/*Test.class" />
    </batchtest>
    </junit>
    </target>
    配置報告形式
    <publishers>
    <currentbuildstatuspublisher file="currentbuild.txt" />
    - <htmlemail mailhost="mail.chelseafc.com.cn" returnaddress="workflow_engine@chelseafc.com.cn" subjectprefix="ContinuousIntegration:" buildresultsurl="http://chelsea:8044/cruisecontrol/buildresults" spamwhilebroken="true" xsldir="F:\software\Agile.Net\cruisecontrol-2.2\reporting\jsp\xsl" css="F:\software\Agile.Net\cruisecontrol-2.2\reporting\jsp\css\cruisecontrol.css" logdir="D:\Tomcat 4.1\webapps\cruisecontrol\samplelogs">
    <always address="chelsea@chelseafc.com.cn" />
    <always address="ajax@chelseafc.com.cn" />
    <map alias="chelsea" address="chelsea@chelseafc.com.cn" />
    </htmlemail>
    </publishers>
    其中CruiseControl暫時沒有提供代碼檢查工具的支持,建議使用Ant來調用CheckStyle,示例如下(沒有真正運行過):
    <target name="web.checkstyle">
    <mkdir dir="${target.temp}/checkstyle" />
    <mkdir dir="${target.web}/checkstyle" />
    - <taskdef resource="checkstyletask.properties">
    - <classpath>
    <fileset dir="${support.tools}/checkstyle31" includes="**/*.jar" />
    </classpath>
    </taskdef>
    - <copy file="${support.tools}/checkstyle31/custom.xml" overwrite="true" tofile="${target.temp}/checkstyle/custom.xml">
    - <filterset>
    <filter token="source.java" value="${basedir}/${source.java}" />
    <filter token="target.checkstyle" value="${basedir}/${target.temp}/checkstyle" />
    </filterset>
    </copy>
    - <checkstyle config="${target.temp}/checkstyle/custom.xml" failOnViolation="false">
    <fileset dir="${source.java}/main" includes="**/*.java" />
    <formatter type="plain" />
    <formatter type="xml" toFile="${target.temp}/checkstyle/checkstyle_errors.xml" />
    </checkstyle>
    <style basedir="${target.temp}/checkstyle" destdir="${target.web}/checkstyle" includes="checkstyle_errors.xml" style="${support.tools}/checkstyle31/checkstyle-noframes.xsl" />
    </target>
    五、幾點提示
    CruiseControl會自動根據本地ClearCase的View監控遠程VOB
    其實除了監控遠程版本控制系統外其它的任務都可以由Ant來完成,CC只負責監控變化并調用Ant即可
    可以為cruisecontrol.bat加入啟動參數“-port 8055”,這樣可以用JMX(http://localhost:8055)來控制cc
    最好避免中文路徑,否則就需要手工為幾個Xml格式的文件,如cc的report Servlet的Web.xml等加入編碼方式“<?xml version="1.0" encoding="UTF-8" ?> ”,或者將中文路徑映射為虛擬硬盤:“subst Y: "D:\cc_view\chelsea\Platform\開發\Nucleus2.0\Source"”
    中文log無法正常顯示時,需要設置CruiseControl配置文件中<log>元素的“encoding”屬性,如:
    <log dir="D:\Tomcat 4.1\webapps\cruisecontrol\samplelogs" encoding="utf-8">
    <merge dir="D:\cc_view\chelseafc\Nucleus2.0\Port\test-results" />
    </log>
    編譯失敗后,在下次checkin之前,一般不需要重新編譯,這時可設置<project >的“buildafterfailed”屬性為false來避免重新編譯
    <htmlemail>的幾個屬性好像沒有缺省設置,雖然文檔里說從2.1.7開始有缺省設置,包括xsldir,css,logdir
    各種工具的安裝、使用,在各自的文檔里都非常詳細,網上亦有無數資源
    六、參考資料
    DailyBuild全攻略
    Draco.Net
    持續集成.Net手冊


    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>