CruiseControl deployment practices

Source: Internet
Author: User
Tags echo message

About CruiseControl

CruiseControl (CC for short) is a continuous integration tool written in java. It has a good framework and can be further developed into a custom continuous integration tool based on it. CruiseControl integrates many plug-ins, such as source code control, email notification, and Real-Time Message notification. In addition, it provides a web interface that allows us to conveniently view the current and historical status of the build project. Although CruiseControl is written in java, it is not limited to building only JAVA projects. You can also build continuous integration environments in various languages using scripts such as ant. The following describes how to deploy a Java project by referring to some documents.

 

CruiseControl environment Configuration

1. download the latest CC compressed package from the official site: http://cruisecontrol.sourceforge.net/download.html. the latest version is 2.8.4. Unzip cruisecontrol-bin-2.8.4.zip to drive D. The file structure is as follows:

 

 

2. Install JDK. CC needs to run in at least JDK 1.4 environment. I installed 1.6 (Note: An error is reported when 1.7 is installed and cannot be run ). Set JAVA_HOME to C: \ Program Files \ Java \ jdk1.6.0 _ 10 in environment variables, and add C: \ Program Files \ Java \ jre6 \ bin to path.

3. Install Subversion. At the beginning, an error is always thrown when the CC is deployed. It probably means that svn cannot be executed. Then, I found that I only installed TortoiseSVN on my computer and didn't install SVN, so I can still use it in the LAN. In addition, if both of them are installed but the versions do not match, an error will be reported. My TortoiseSVN version is 1.7.5, and I still cannot run SVN 1.6.6, reminding that it must be 1.7.0 or above, add Subversion \ bin to path.

4. Run cruisecontrol. bat in the root directory. Enter http: // localhost: 8080/dashboard/in the browser.

 

 

5. Check the source code from the SVN repository. CruiseControl does not support Automatic Code check-out for the first time. Therefore, you must manually checkout the project code to the local machine before building the project. The project Code is put on Google Code (SVN is used for Google Code), the name is project_test, and the source file is put under the trunk directory. Check out the code to the cruisecontrol-bin-2.8.4/projects/project_test Directory, which ensures that the build. xml file is located. Build File Content: (call ANT to execute the integration process, including clearing directories, compiling, sleep, and packaging)

 

<Project name = "project_test" default = "all" basedir = ".">

<Property file = "build. properties"/>

<Path id = "project. classpath">

<Pathelement location = "$ {svnjavahl. jar}"/>

<Pathelement location = "$ {svnant. jar}"/>

<Pathelement location = "$ {svnClientAdapter. jar}"/>

</Path>

<Target name = "all" depends = "clean, compile, sleep, jar"/>

<Target name = "clean">

<Delete dir = "target" quiet = "true"/>

</Target>

<Target name = "compile">

<Mkdir dir = "target/classes"/>

<Javac srcdir = "src" destdir = "target/classes">

<Classpath>

<Pathelement location = "build/lib/$ {app. name}. jar"/>

<Pathelement path = "$ {basedir}/lib"/>

</Classpath>

</Javac>

</Target>

<Target name = "sleep">

<Echo message = "Sleeping for a while so you can see the build in the new dashboard"/>

<Sleep seconds = "5"/>

</Target>

<Target name = "jar" depends = "compile">

<Jar jarfile = "target/project_test.jar" basedir = "target/classes"/>

</Target>

</Project>

 

6. modify the configuration file. Add the following code snippet to the config. xml file, which is located under the <CruiseControl> node.

 

<Project name = "project_test"> # The project name must be the same as that in the projects directory.

<Listeners>

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

</Listeners>

<Bootstrappers>

<Svnbootstrapper localWorkingCopy = "projects/$ {project. name}"/>

</Bootstrappers>

<Modificationset quietperiod = "30">

<Svn localWorkingCopy = "projects/$ {project. name}"/>

</Modificationset>

<Schedule interval = "300" type = "codeph" text = "/codeph">

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

<Exec command = "D :\ cruisecontrol-bin-2.8.4 \ cruisecontrol. bat"/>

</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>

<Email buildresultsurl = "http: // localhost: 8080/cruisecontrol/buildresults/$ {project. name}" mailhost = "smtp.163.com"

Mailport = "25" defaultsuffix = "@ 163.com" username =" tester000001@163.com "password =" qatest11112 "returnname =" CruiseControl "skipusers =" true "Login =" true "returnaddress =" tester000001@163.com">

<Always address = "tester000001@163.com"/>

</Email> # Set the sending result email.

</Publishers>

</Project>

7. Save and wait for the result to be viewed. Based on the above configuration, CC will perform a new round of check and build in five minutes, and add the new project as follows:

 

Email: Build result:

8. Follow-up research on configuration and monitoring issues


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.