zoukankan      html  css  js  c++  java
  • [CruiseControl]在Windows上配置实例


    一 CruiseControl安装

    1) 安装JAVA SDK,设置JAVA_HOME环境变量,且将%JAVA_HOME%\bin加入path环境变量。

    2) 下载CruiseControl,例如2.8.3版本为cruisecontrol-bin-2.8.3.zip,解压到C:\CruiseControl。

    3)  CruiseControl的binary安装中已经包含了ant builder / jetty(提供http server and jmx 对webapps下的cruisecontrol[result/report JSP page] 和 dashboard支持) ,安装后如下:

     


    二 配置

    以CruiseControl自带实例connectfour为例,配置文件如下:

    1)config.xml

    <cruisecontrol>
        
    <project name="connectfour">

            
    <listeners>
                
    <currentbuildstatuslistener file="logs/${project.name}/status.txt"/>
            
    </listeners>

            
    <bootstrappers>
                
    <antbootstrapper anthome="apache-ant-1.7.0" buildfile="projects/${project.name}/build.xml" target="clean" />
            
    </bootstrappers>

            
    <modificationset quietperiod="30">
                
    <!-- touch any file in connectfour project to trigger a build -->
                
    <filesystem folder="projects/${project.name}"/>
            
    </modificationset>

            
    <schedule interval="300">
                
    <ant anthome="apache-ant-1.7.0" buildfile="projects/${project.name}/build.xml"/>
            
    </schedule>

            
    <log>
                
    <merge dir="projects/${project.name}/target/test-results"/>
            
    </log>

            
    <publishers>
                
    <onsuccess>
                    
    <artifactspublisher dest="artifacts/${project.name}" file="projects/${project.name}/target/${project.name}.jar"/>
                
    </onsuccess>
            
    </publishers>

        
    </project>
    </cruisecontrol>


    2)dashboard-config.xml

    <?xml version="1.0" encoding="UTF-8"?>

     
    <dashboard>
         
    <buildloop
            
    logsdir=""
                  artifactsdir="" />
        
    <features allowforcebuild=""/>
        
    <trackingtool projectname="" baseurl="" keywords=""/>
         
    <subtabs>
            
    <subtab class="net.sourceforge.cruisecontrol.dashboard.widgets.ErrorsAndWarningsMessagesWidget" />
        
    </subtabs>
    </dashboard>


    三 运行

    1) 运行CruiseControl.bat来启动CruiseControl,

    REM CruiseControl.bat

    REM
     Set this if you're using SSH-based CVS
    REM
     set CVS_RSH=

    REM Uncomment the following line if you have OutOfMemoryError errors
    REM
     set CC_OPTS=-Xms128m -Xmx256m

    REM The root of the CruiseControl directory.  The key requirement is that this is the parent
    REM
     directory of CruiseControl's lib and dist directories.
    REM
     By default assume they are using the batch file from the local directory.
    REM
     Acknowledgments to Ant Project for this batch file incantation
    REM
     %~dp0 is name of current script under NT
    set CCDIR=%~dp0

    :checkJava
    if not defined JAVA_HOME goto noJavaHome
    set JAVA_PATH="%JAVA_HOME%\bin\java"
    set CRUISE_PATH=%JAVA_HOME%\lib\tools.jar
    goto setCruise

    :noJavaHome
    echo WARNING: You have not set the JAVA_HOME environment variable. Any tasks relying on the tools.jar file (such as "<javac>") will not work properly.
    set JAVA_PATH=java

    :setCruise
    set LIBDIR=%CCDIR%lib

    set LAUNCHER=%LIBDIR%\cruisecontrol-launcher.jar

    set JETTY_LOGS=%CCIDR%logs

    set EXEC=%JAVA_PATH% %CC_OPTS% -Djavax.management.builder.initial=mx4j.server.MX4JMBeanServerBuilder "-Djetty.logs=%JETTY_LOGS%"
    -jar 
    "%LAUNCHER%" %* -jmxport 8000 -webport 8080 -rmiport 1099
    echo %EXEC%
    %EXEC%


    2) CruiseControl的启动log

    2010-07-19 04:42:51,712 [main     ] INFO  Main             - CruiseControl Version 2.8.3 Compiled on January 24 2010 2134
    2010-07-19 04:42:51,805 [main     ] INFO  XMLConfigManager - reading settings from config file [C:\CruiseControl\config.xml]
    2010-07-19 04:42:52,446 [main     ] INFO  CruiseControlController - projectName = [connectfour]
    2010-07-19 04:42:52,446 [main     ] INFO  XMLConfigManager - using settings from config file [C:\CruiseControl\config.xml]
    2010-07-19 04:42:52,477 [main     ] WARN  ProjectConfig    - No previously serialized project found [C:\CruiseControl\connectfour.ser], forcing a build.
    2010-07-19 04:42:52,477 [main     ] INFO  Project          - Project connectfour starting
    2010-07-19 04:42:52,477 [main     ] INFO  Project          - Project connectfour:  idle
    2010-07-19 04:42:52,509 [Project connectfour thread] INFO  Project          - Project connectfour started
    2010-07-19 04:42:52,540 [Project connectfour thread] INFO  Project          - Project connectfour:  in build queue
    2010-07-19 04:42:53,665 [main     ] INFO  CruiseControlControllerAgent - Starting HttpAdaptor with CC-Stylesheets
    2010-07-19 04:42:53,743 [main     ] INFO  CruiseControlControllerAgent - starting httpAdaptor
    2010-07-19 04:42:54,071 [main     ] INFO  CruiseControlControllerAgent - starting rmiRegistry
    2010-07-19 04:42:56,384 [main     ] INFO  CruiseControlControllerAgent - starting connectorServer
    2010-07-19 04:43:18,555 [BuildQueueThread] INFO  BuildQueue       - BuildQueue started
    2010-07-19 04:43:18,555 [BuildQueueThread] INFO  BuildQueue       - now adding to the thread queue: connectfour
    2010-07-19 04:43:18,618 [Thread-21] INFO  Project          - Project connectfour:  bootstrapping
    2010-07-19 04:43:18,665 [Thread-21] INFO  ProjectController - connectfour Controller: build progress event: bootstrapping
    2010-07-19 04:43:23,102 [Thread-23] INFO  ScriptRunner     - Buildfile: projects\connectfour\build.xml
    2010-07-19 04:43:23,321 [Thread-23] INFO  ScriptRunner     - 
    2010-07-19 04:43:23,321 [Thread-23] INFO  ScriptRunner     - clean:
    2010-07-19 04:43:23,462 [Thread-23] INFO  ScriptRunner     -    [delete] Deleting directory C:\CruiseControl\projects\connectfour\target
    2010-07-19 04:43:23,993 [Thread-23] INFO  ScriptRunner     - 
    2010-07-19 04:43:23,993 [Thread-23] INFO  ScriptRunner     - BUILD SUCCESSFUL
    2010-07-19 04:43:23,993 [Thread-23] INFO  ScriptRunner     - Total time0 seconds
    2010-07-19 04:43:24,196 [Thread-21] INFO  AntBootstrapper  - Bootstrap successful.
    2010-07-19 04:43:24,212 [Thread-21] INFO  Project          - Project connectfour:  checking for modifications
    2010-07-19 04:43:24,212 [Thread-21] INFO  ProjectController - connectfour Controller: build progress event: checking for modifications
    2010-07-19 04:43:24,509 [Thread-21] INFO  Project          - Project connectfour:  No modifications found, build not necessary.
    2010-07-19 04:43:24,509 [Thread-21] INFO  Project          - Project connectfour:  Building anyway, since build was explicitly forced.
    2010-07-19 04:43:24,509 [Thread-21] INFO  Project          - Project connectfour:  now building
    2010-07-19 04:43:24,509 [Thread-21] INFO  ProjectController - connectfour Controller: build progress event: now building
    2010-07-19 04:43:25,305 [Thread-25] INFO  ScriptRunner     - Buildfile: projects\connectfour\build.xml
    2010-07-19 04:43:25,540 [Thread-25] INFO  ScriptRunner     - ccAntProgress -- clean
    2010-07-19 04:43:25,602 [Thread-25] INFO  ScriptRunner     - ccAntProgress -- compile
    2010-07-19 04:43:25,665 [Thread-25] INFO  ScriptRunner     -     [mkdir] Created dir: C:\CruiseControl\projects\connectfour\target\classes
    2010-07-19 04:43:26,446 [Thread-25] INFO  ScriptRunner     -     [javac] Compiling 10 source files to C:\CruiseControl\projects\connectfour\target\classes
    2010-07-19 04:43:34,118 [Thread-25] INFO  ScriptRunner     - ccAntProgress -- sleep
    2010-07-19 04:43:34,149 [Thread-25] INFO  ScriptRunner     -      [echo] Sleeping for a while so you can see the build in the new dashboard
    2010-07-19 04:44:34,805 [Thread-25] INFO  ScriptRunner     - ccAntProgress -- test
    2010-07-19 04:44:35,555 [Thread-25] INFO  ScriptRunner     -     [mkdir] Created dir: C:\CruiseControl\projects\connectfour\target\test-classes
    2010-07-19 04:44:40,290 [Thread-25] INFO  ScriptRunner     -     [javac] Compiling 2 source files to C:\CruiseControl\projects\connectfour\target\test-classes
    2010-07-19 04:45:08,384 [Thread-25] INFO  ScriptRunner     -     [mkdir] Created dir: C:\CruiseControl\projects\connectfour\target\test-results
    2010-07-19 04:45:10,243 [Thread-25] INFO  ScriptRunner     -     [junit] Running net.sourceforge.cruisecontrol.sampleproject.connectfour.CellTest
    2010-07-19 04:45:10,243 [Thread-25] INFO  ScriptRunner     -     [junit] Testsuite: net.sourceforge.cruisecontrol.sampleproject.connectfour.CellTest
    2010-07-19 04:45:14,196 [Thread-25] INFO  ScriptRunner     -     [junit] Tests run1, Failures: 0, Errors: 0, Time elapsed: 3.953 sec
    2010-07-19 04:45:14,196 [Thread-25] INFO  ScriptRunner     -     [junit] Tests run1, Failures: 0, Errors: 0, Time elapsed: 3.953 sec
    2010-07-19 04:45:14,212 [Thread-25] INFO  ScriptRunner     -     [junit] 
    2010-07-19 04:45:14,805 [Thread-25] INFO  ScriptRunner     -     [junit] Running net.sourceforge.cruisecontrol.sampleproject.connectfour.PlayingStandTest
    2010-07-19 04:45:14,805 [Thread-25] INFO  ScriptRunner     -     [junit] Testsuite: net.sourceforge.cruisecontrol.sampleproject.connectfour.PlayingStandTest
    2010-07-19 04:45:14,837 [Thread-25] INFO  ScriptRunner     -     [junit] Tests run10, Failures: 0, Errors: 0, Time elapsed: 0.032 sec
    2010-07-19 04:45:14,837 [Thread-25] INFO  ScriptRunner     -     [junit] Tests run10, Failures: 0, Errors: 0, Time elapsed: 0.032 sec
    2010-07-19 04:45:14,837 [Thread-25] INFO  ScriptRunner     -     [junit] 
    2010-07-19 04:45:14,852 [Thread-25] INFO  ScriptRunner     - ccAntProgress -- jar
    2010-07-19 04:45:15,149 [Thread-25] INFO  ScriptRunner     -       [jar] Building jar: C:\CruiseControl\projects\connectfour\target\connectfour.jar
    2010-07-19 04:45:15,430 [Thread-25] INFO  ScriptRunner     - ccAntProgress -- all
    2010-07-19 04:45:15,430 [Thread-25] INFO  ScriptRunner     - 
    2010-07-19 04:45:15,446 [Thread-25] INFO  ScriptRunner     - BUILD SUCCESSFUL
    2010-07-19 04:45:15,446 [Thread-25] INFO  ScriptRunner     - Total time1 minute 49 seconds
    2010-07-19 04:45:16,259 [Thread-21] INFO  ProjectController - connectfour Controller: build result event: build successful
    2010-07-19 04:45:16,259 [Thread-21] INFO  Project          - Project connectfour:  merging accumulated log files
    2010-07-19 04:45:16,274 [Thread-21] INFO  ProjectController - connectfour Controller: build progress event: merging accumulated log files
    2010-07-19 04:45:16,415 [Thread-21] INFO  Project          - Project connectfour:  build successful
    2010-07-19 04:45:16,493 [Thread-21] INFO  Project          - Project connectfour:  publishing build results
    2010-07-19 04:45:16,493 [Thread-21] INFO  ProjectController - connectfour Controller: build progress event: publishing build results
    2010-07-19 04:45:17,009 [Thread-21] INFO  Project          - Project connectfour:  idle
    2010-07-19 04:45:17,009 [Thread-21] INFO  ProjectController - connectfour Controller: build progress event: idle
    2010-07-19 04:45:17,087 [Project connectfour thread] INFO  Project          - Project connectfour:  next build in 5 minutes 
    2010-07-19 04:45:17,087 [Project connectfour thread] INFO  Project          - Project connectfour:  waiting for next time to build
    2010-07-19 04:45:17,087 [Project connectfour thread] INFO  ProjectController - connectfour Controller: build progress event: waiting for next time to build


    3)connectfour的ant的log

    Buildfile: projects\connectfour\build.xml
    ccAntProgress -- clean
    ccAntProgress -- compile
        [mkdir] Created dir: C:\CruiseControl\projects\connectfour\target\classes
        [javac] Compiling 10 source files to C:\CruiseControl\projects\connectfour\target\classes
    ccAntProgress -- sleep
         [echo] Sleeping for a while so you can see the build in the new dashboard
    ccAntProgress -- test
        [mkdir] Created dir: C:\CruiseControl\projects\connectfour\target\test-classes
        [javac] Compiling 2 source files to C:\CruiseControl\projects\connectfour\target\test-classes
        [mkdir] Created dir: C:\CruiseControl\projects\connectfour\target\test-results
        [junit] Running net.sourceforge.cruisecontrol.sampleproject.connectfour.CellTest
        [junit] Testsuite: net.sourceforge.cruisecontrol.sampleproject.connectfour.CellTest
        [junit] Tests run1, Failures: 0, Errors: 0, Time elapsed: 3.953 sec
        [junit] Tests run1, Failures: 0, Errors: 0, Time elapsed: 3.953 sec
        [junit] 
        [junit] Running net.sourceforge.cruisecontrol.sampleproject.connectfour.PlayingStandTest
        [junit] Testsuite: net.sourceforge.cruisecontrol.sampleproject.connectfour.PlayingStandTest
        [junit] Tests run10, Failures: 0, Errors: 0, Time elapsed: 0.032 sec
        [junit] Tests run10, Failures: 0, Errors: 0, Time elapsed: 0.032 sec
        [junit] 
    ccAntProgress -- jar
          [jar] Building jar: C:\CruiseControl\projects\connectfour\target\connectfour.jar
    ccAntProgress -- all

    BUILD SUCCESSFUL
    Total time1 minute 49 seconds

    4)build后通过curisecontrol page(report JSP)查看结果

     


    5)build后通过dashborad来查看结果

     

    6)build后通过dashboard的build tab来查看build统计


     

    7)通过JMX来管理

     

    完!


    作者:iTech
    微信公众号: cicdops
    出处:http://itech.cnblogs.com/
    github:https://github.com/cicdops/cicdops

  • 相关阅读:
    Maven3路程(一)用Maven创建第一个web项目(1)
    ECLIPSE下SVN的创建分支/合并/切换使用
    Oracle 客户端免安装数据库连接
    如何用Maven创建web项目(具体步骤)
    使用Eclipse构建Maven项目 (step-by-step)
    Maven安装配置
    动画基础(隐式动画)
    CA*Layer(CAReplicatorLayer--)
    CA*Layer(CATransformLayer--CAGradientLayer)
    CA*Layer(CAShapeLayer--CATextLayer)
  • 原文地址:https://www.cnblogs.com/itech/p/1780762.html
Copyright © 2011-2022 走看看