This document uses cvsnt as the source code management server and wincvs as the client. Before proceeding, make sure that cvsnt and wincvs are installed on the system.
1. Download
The latest version of cruisecontrol is V 2.6.2, which can be downloaded from the http://cruisecontrol.sourceforge.net.
Ii. Installation
1. directory structure
In Windows is the use of executable files: CruiseControl-2.6.2.rc1.exe, installed after the Directory includes:
2. Description of files and directories:
Cruisecontrol. Bat Startup file;
Config. xml configuration file (default configuration file name );
Apache-ant-1.6.5 is the ant environment that comes with cruisecontrol. cruisecontrol uses ant to complete some specified tasks;
Docs includes the usage documents of cruisecontrol and a helloworld example;
Lib is the jar package required for running;
Logs log directory, which stores the logs generated during creation;
The Directory of the project to be built is also the default directory of checkout. All the build projects are named as directories in the project. Under the project directory, there is a built-in project connectfour, contains SRC, Lib, test, and build. XML.
Webapps web application directory. Cruisecontrol has built-in jetty as a Web Container. You can view the building result on the web and manually create a project;
Artifacts output directory. The jar generated after integration is saved here. Is just installed, so this directory does not exist.
3. First Contact
After the installation is complete, enter the directory of cruisecontrol. bat at the CMD prompt.
Run:
> Cruisecontrol
1. control terminal output information
The control end outputs a lot of information and has some errors. It doesn't matter because the default configuration of cruisecontrol is SVN. This will be modified later. After the execution is completed, the program will not exit and is in the waiting state.
2. View File Content Changes
View the cruisecontrol directory and you will find three more files. Artifaces is the directory that saves the build results mentioned above.
View the artifaces directory to view the contents of the newly generated connectfour project, including connectfour. jar.
3. View on the Web
Open the browser and access http: // 127.0.0.1: 8080/. The cruisecontrol interface is displayed.
Close the CMD console or exit the cruisecontrol and proceed to the next step.
Iii. Configuration
In order to make cruisecontrol work properly, you need to configure it properly.
Cruisecontrol (CC) has two configuration files:
One is config. XML, which is the configuration of parameters for CC initialization, scheduling, and other tasks;
One is the configuration file executed by build. xml and ant. CC uses ant to complete specified tasks, such as checkout, compile, jar, and test.
Iv. Examples
The following describes the procedure based on an example.
1. Copy the helloworld directory under docs/main to the project directory.
2. Keep the src directory and cvs-build.xml files in the project/helloworld directory, and delete all others.
Note: the original files of these files are still in docs/main and may be used in the future.
3. Modify the file name cvs-build.xml to build. xml.
4. Modify the build. xml file: you only need to modify the content of the property part. Other content remains unchanged:
A. Comment out build. compiler and build. compiler. emacs.
<! -- Property name = "build. compiler" value = "jikes"/-->
<! -- Property name = "build. compiler. emacs" value = "true"/-->
B. Modify cvs. repository as your cvsnt access parameters:
<Property name = "cvs. repository" value = ": pserver: cvsusername: cvsPassworld@127.0.0.1:/cvsroot"/>
C. Modify cvs. package to the module name, that is, the name of the project to be constructed. Here is helloworld.
<Property name = "cvs. Package" value = "helloworld"/>
D. Change the value of Dist. dir to target, which is the release directory and must be consistent with the value specified in config. xml.
<Property name = "Dist. dir" value = "target"/>
The complete property modification is as follows:
<! -- Property name = "build. compiler" value = "jikes"/-->
<! -- Property name = "build. compiler. emacs" value = "true"/-->
<Property name = "build. dir" value = "classes"/>
<Property name = "Dist. dir" value = "target"/>
<Property name = "logdir" value = "logs"/>
<Property name = "source. dir" value = "src"/>
<Property name = "JUnit. Results" value = "test-Results"/>
<Property name = "cvs. repository" value = ": pserver: cvsusername: cvsPassworld@127.0.0.1:/cvsroot"/>
<Property name = "cvs. Package" value = "helloworld"/>
5. Modify config. xml
A. Change the property value of the project name to helloworld.
<Project name = "helloworld">
B. Change svnbootstrapper to cvsbootstrapper.
<Svnbootstrapper localworkingcopy = "projects/$ {project. name}"/>
C. Change SVN to CVS. <SVN localworkingcopy = "projects/$ {project. name}"/>
D. Change the Dir value of the merge attribute to projects/$ {project. name}/target/test-results.
<Merge dir = "projects/$ {project. name}/target/test-Results"/>
The complete config. xml after modification is as follows: <cruisecontrol>
<Project name = "helloworld">
<Listeners>
<Currentbuildstatuslistener file = "logs/$ {project. name}/status.txt"/>
</Listeners>
<Bootstrappers>
<Cvsbootstrapper localworkingcopy = "projects/$ {project. name}"/>
</Bootstrappers>
<Modificationset quietperiod = "30">
<CVS localworkingcopy = "projects/$ {project. name}"/>
</Modificationset>
<Schedule interval = "300" type = "codeph" text = "/codeph">
<Ant anthome = "Apache-ant-1.6.5" buildfile = "projects/$ {project. name}/build. xml"/>
</Schedule>
<Log>
<Merge dir = "projects/$ {project. name}/test-Results"/>
</Log>
<Publishers>
<Onsuccess>
<Artifactspublisher DEST = "artifacts/$ {project. name}" file = "projects/$ {project. name}/target/$ {project. name}. Jar"/>
</Onsuccess>
</Publishers>
</Project>
</Cruisecontrol>
6. Use wincvs to import Project/helloworld to CVS.
7. Delete Project/helloworld
8. Execute helloworld from CVS to the project directory.
9. Run the cvsroot command from CVS to the project directory.
10. Create a file named users in the cvsroot directory without the extension. The file content is as follows:
# Cruisecontrol login mapping email Configuration
# $ ID $
Cvsusername: cvsUserName@127.0.0.1
Note: (this step is very important; otherwise, CVS cannot be accessed)
Cvsusername is the username used to access CVs. Use the colon (:) For ing. The ing value adds the @ symbol to the CVS user name and the IP address of the CVS service.
Then, the users file is checkin to the CVS server. At this time, the cvsroot directory in the project is useless and can be deleted.
11. Run cruisecontrol
No errors.
In the artifacts directory, you can see the helloworld project and the directory named after the generation time. The directory contains the project output jar.
The corresponding project/helloworld and logs/helloworld also generate the corresponding files and test directories.
12. View through web
Access http: // 127.0.0.1: 8080 in a browser and you will see the CC homepage, for example:
The figure shows the Project Build time, whether the project is successful, and the build Label. You can also manually click the build button to divide CC to execute the build task immediately. Otherwise, CC will wait for the next build time (in config. XML, the value of interval in the Schedule attribute sets the build execution interval in seconds. The default value is 5 minutes)
Click helloworld to view the project Building Details.
1. Left menu ().
You can switch to another project or project list to display the history of the current project.
2. Build result ().
Shows whether the unit test is successful, the modified file list, and so on, and connects to the download page of the build result jar.
3. Unit Testing ()
View detailed test classes, test methods, and test results.
4. statistical charts ()
5. Control Panel ()
5. Continuous Construction
Are these all continuous builds? No!
1. Modify the helloworld. Java file under projects/helloworld/src/Hello, for example, adding a space.
2. Submit the changes to helloworld. Java to the CVS server.
3. Wait for 5 minutes... once every 5 minutes, CC will automatically detect file changes from the CVS server, and then checkout to the project/helloworld directory for construction, including compilation, testing, packaging, and publishing.
CC solves the problem that the development mode is to divide modules at the beginning of the project, and then integrate all the code for testing after development, and then discover the problem at the end of the integration, developers need to spend a lot of time in the integration phase to find the root cause of the bug. Coupled with the complexity of the software, it is difficult to locate the root cause of the problem, and even have to adjust the underlying architecture.
<End>