Getting started with Continuum

Source: Internet
Author: User
Continuum entry-instance

Although this article is the beginning of continuum, but does not involve the history, download and installation of continuum, these content can be learned on the official website of continuum (http://maven.apache.org/continuum. This article describes the basic method of using Continuum with an example. The Maven project used here is an instance in Maven getting started-Concepts and instances (a download link is provided at the end of this Article ).
Note: Reprinted please indicate the original author (jiangshachina) and the source (http://www.blogjava.net/jiangshachina )!

1. Benefits of continuous integration
1.1 early submission, frequent submission
Continuous integration is the most efficient when developers submit files regularly. This means that incomplete Code cannot be submitted, but every change is not great and there is a good test. In this way, you can better find errors in the code.
1.2 build as frequently as possible
Frequent builds may be affected by the amount of work required for building and the performance of the machines involved in building. However, frequent builds can indeed detect errors as early as possible before developers shift their attention. At any time, when any commit occurs, continuum can trigger a build job. This means that these build tasks should be faster for a large number of build tasks or performance tests.
1.3 create a stable environment
If this build is not a member of another development, test, or product environment, you can avoid customizing JDK or other local settings. If a build fails in the continuous integration environment, it will be isolated from the modifications that cause it and can be used independently of the running environment.
1.4 run clean build
It is very useful to build quickly and repeatedly. It is also important that the build will not fail due to the old build status. With regular considerations, you can get a clean build. By default, continuum performs clean build. In the future, it allows developers to request an initial checkout according to the selected schedule.
2 instances
2.1 Conception
The Maven project to be continuously integrated in this instance isMaven entry-Concepts and Instances. The SCM used is subversion, that is, it is assumed that the Subversion server and the command line client have been installed. Our goal is to use continuum to regularly and continuously integrate the maven project demo (including its sub-projects. The following paths are available in the environment of this article:
Continuum_home= D: \ continuum
Svn_repoitory= E: \ svn-repo \ Repository
Maven_demo= D: \ Maven \ demo
Continuum_maven= D: \ Maven \ continuum // This directory stores the maven Demo project downloaded from subversion
2.2 initialize the Subversion repository.
Repository generation: svnadmin createSvn_repository
Import the files in maven_demo to the repository:
SVN import maven_demo file :///Svn_repoitory/Demo-M "Initial import Demo"
Download the files in the repository again (run the following command in the directory continuum_maven ):
SVN checkout file :///Svn_repoitory/Demo
2.3 start continuum
Assume that continuum has been installed, but it has not been run. To run continuum, double-clickContinuum_home\ Bin \ Win32 \ Run. BAT file. For the first running, some errors will be reported: ......
Warn RDBMS-error initialising Derby Schema: schema 'sa 'does not exist
Error 42y07: schema 'sa 'does not exist
......

This is normal, because the Continuum background uses the Apache Derby database. Before the first running, some tables and data required by Continuum do not exist. However, continuum initializes the data. These errors will not occur when continuum is started for 2nd times.
The Continuum server uses port 8080 by default. If the port is occupied, the startup will fail. To solve this problem, we need to modify the JAR FileContinuum_homeThe \ conf \ application. xml file in the \ apps \ continuum-plexus-application-1.0.3.jar. Search8080(This value is unique). It will be changed to the port value you specified. This article uses8081. After the above process, the continuum server should be able to start normally. The following describes the Initialization Configuration of continuum.
2.4 initialize Configuration
Use the address http: // localhost: 8081/continuum in the browser to log on to the Continuum console, as shown in.

After you log on to continuum for the first time, you need to perform some configuration. It mainly includes the user name/password, workspace directory, build output directory, and company information. The main parameter values are as follows:
Working directory = D: \ continuum \ Workspace
Build output directory = D: \ continuum \ workspace \ output
Base url = http: // localhost: 8081/continuum/servlet/continuum
// Use the company information here to borrow the information of this blog site *_*
Company Name = blogjava
Company logo = http://www.blogjava.net/images/logo.gif
Company url = http://www.blogjava.net/
The following figure is displayed after submission (Can you see the blogjava logo *_*)

Use the username and password set during initial configuration to log on to the Continuum console.
2.5 modify the POM File
In the DirectoryContinuum_mavenRun the following command to download the maven project demo again:
SVN checkout file :///Svn_repository/Demo
To be able to be used by continuum and work with subversion, You need to modify the POM file in the original Maven project. Add the following statements to each pom: <Project>
......
<Cimanagement>
<System> continuum </system>
<URL> http: // localhost: 8081/continuum/servlet/continuum </URL>
<Notifiers>
<Notifier>
<Type> mail </type>
<Address> jiangshachina@163.com </address>
</Notifier>
</Notifiers>
</Cimanagement>

<SCM>
<Connection> SCM: SVN: file: // localhost/Svn_repository/Projectname</Connection>
</SCM>
......
</Project>

WhereProjectnameIt must be consistent with the current project name of POM, for example, for POM in the demo directory,ProjectnameIs demo. After these three files are modified, submit them to the Subversion server.Current Directory of each POMRun the following command:
SVN commit Pom. XML-M "My Settings"
To run each project separately, you must install the entire demo and its sub-projects in the maven repository.Maven_demo DirectoryRun the following command:
MVN install
2.6 Add a Maven Project
Log on to the Continuum console and click "Maven 2.0 + Project" in the "add project" group on the left ". There are two ways to add a maven2 project: Enter the URL of the POM file and upload the POM file directly. The former applies to any Maven project; the latter can only apply to Maven projects without a module, that is, no sub-project. Because the maven project demo used in this article has two sub-projects, you can only use the previous method.

You only need to load the POM file of the top-level project. continuum will automatically load the POM file of other moudel files. As shown in, enter:
File: // D:/Maven/continuum/demo/POM. xml
After submission, the following figure is displayed, indicating that the maven project has been correctly loaded to continuum.

When the project is loaded, continuum will download these projectsWorking directory(See section 2.4), andBuild output directory(See section 2.4) generate an output directory for each project (only some log files are started ). Careful friends may find that after the above work is completed, the build status of the sub-project "ce Maven demo-app" and "ce Maven demo-webapp" is still "queued build ". This is actually a bug in continuum! In many cases, continnum does not automatically refresh the page. You need to manually refresh the page, that is, click "show projects.But please do not use the refresh button in the browser, this may re-submit your request.This bug will be fixed in continuum1.1. After the page is refreshed, the build status of the app and webapp will be consistent with that of the demo project.
2.7 first build
To build any Maven project, you only need to click "build now" on the right of a project to build the project. For example, if we click the "build now" button corresponding to the demo project, continuum will execute build according to the POM file in the demo. After the build is complete, the status of the build result is displayed: Success, failure, or error (but please refresh the page manually at any time ). The number of builds will also change from 0 to 1.

Click the number in the column "build" in the table to view the detailed process of this build, as shown in.

2.8 set the timetable
As mentioned earlier, continuous integration requires regular build. That is, you need to create a timetable for the continuous integration server to build according to this table. The default time for continuum is to build every hour every day. We can also set up our own schedules. Click "schedules" in the administration group to find the current default timetable. Click "add" to add a new timetable, as shown in.

The most important of these parameter items is the cron expression, which defines the time rule for continuum to execute build. For its syntax rules, see participating resources [4]. The schedule is: build every minute between-every day. Select the Enable check box and submit it again. The schedule can be used.
To use the created schedule, we need to go to the project view page. Click "show projects" --> Project Name (such as Ce Maven demo) to view the details of the project, as shown in.

In the goals of the build definitions item in the project view, we can find that the schedule used is the "default_schedule" time table. Click the "add" button and select the newly created "my first schedule" schedule (as shown in) in the Schedule drop-down list box. after submitting the schedule, the new schedule will be adopted.

4. Summary
According to the previous descriptions, we should be able to have some perceptual knowledge about the use of continuum. Since continuum is a sub-project of Maven, it has built-in support for maven2, so it can be well integrated with Maven. Currently, continuum supports ant and shell script projects. Using continuum + Maven can clean and frequently integrate projects, improve build efficiency and promote healthy development of projects.
5. Parameter Resources
[1] Continuum official website. http://maven.apache.org/continuum/
[2] Continuum reference documentation. http://maven.apache.org/continuum/guides/index.html
[3] better build with Maven. http://www.mergere.com/m2book_download.jsp
[4] cron expression syntax rules. http://www.opensymphony.com/quartz/api/org/quartz/CronTrigger.html

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.