Continuous integration-platform building (Hudson + sonar)

Source: Internet
Author: User

HUdsonIs a scalable continuous integration engine. It is mainly used for: continuous and automatic construction/testing of software projects. It monitors some scheduled tasks.

SonarIt is an open-source quality management platform that focuses on continuous analysis and measurement technology quality from projects to class methods. It integrates code quality-related software for unified management;

 

To put it simply,

HudsonIs a continuous, automatic building/testing software project,

WhileSonarIt is continuous and automatic statistics and analysis of quality data related to software projects, such as pass rate, coverage rate, Code complexity, number of lines of code, and so on, used to evaluate and measure the quality of software projects.

Hudson:

Http://hudson-ci.org/

Sonar:

Http://www.sonarsource.org/

 

Build:

1. installation:

1) download the latest version (which is packaged as a war file ). Hudson Official Website: http://hudson-ci.org/

2) Runjava -jar hudson.war

Note: Hudson needs to run Java 5 or a later version.

Another installation method is to deploy the downloaded war package file to the servlet container and start the container. In the URL address bar of the browser, enter a file similar to http: // localhost: 8088/Hudson. Is the interface after the installation is successful (using the XP + Tomcat + java5 environment ):

2. Start: Enter/home/username/Apache-Tomcat-6.0.20/bin in the server directory.

Run the shutdown. Sh or startup. Sh script to restart or stop the instance.

3. System Configuration:

On the running Hudson homepage, choose System Management> system settings on the left:

On the system configuration page, the first item in this list isHome Directory. This includes all the workspaces that Hudson wants to execute and all the configurations that store it.

To configure a JDK and maven2 instance, clickAddClick to add the Instance name and absolute address.

We recommend that you do not select the install automatically option, but enter the installation path of your local Java and maven2 and name it.

Next, we will introduce the meaning of other text information on this page:

System. Message enter instructions
Quiet Period: the time (in seconds) for Hudson to regularly build the project)
Enable Security: Set logon rules for Hudson (Anonymous logon by default). For details, see the following description.
TCP port for JNLP slave agents: I don't know what JNLP is. In short, there are three methods: fixed (fixed) random (Radom) not used (Disabled). When fixed, JNLP information can be entered.

Security realm: You can use middleware containers, databases, and LDAP to verify security,

Authorized: authentication methods that allow you to set identities: system users, anonymous users, Custom Users, and inherited users (anonymous users are also recommended in this study)
JDK installations: Set the JDK installation path
Shell executable: Set the window shell command
Ant installation: Set the installation path of ant
Set Mave installation path
CVS executable: Specifies the route (cvs.exe) of the cvsnt execution process)
. Cvspass file: set the path of the cvsnt administrator file (passwd file)
E-mail Notification: Set the email address sent when an error occurs.
Hudson URL: the default address of Hudson.

You can also configure other aspects of the server, such as providing the location of an email server to Hudson to receive emails when the build fails. You may need to ask the system administrator to help set this feature based on your organization's email setting method. Setting email is not required; Hudson also supports RSS as a notification mechanism, which is better for some people than email. The notification mechanism you choose depends on you.

 

Build:

1. Download
Download the sonar package from the official website and unzip it to any directory http://www.sonarsource.org/downloads/.

2. MySQL Database Installation

Go to the SQL Web site to download MySQL RPM package: MySQL-client-community-5.1.45-1.rhel5.i386.rpm and MySQL-server-community-5.1.45-1.rhel5.i386.rpm

Respectively

Rpm-IVH MySQL-server-community-5.1.45-1.rhel5.i386.rpm

Rpm-IVH MySQL-client-community-5.1.45-1.rhel5.i386.rpm

3. log on to MySQL. The initial username and password of MySQL are root/empty.

Normal logon is mysql-u sonar-P sonar

4. Create a database

Sonar uses the embedded Derby database by default. to migrate to MySQL, you must first create a MySQL database for the sonar/sonar UTF-8 and authorize access to the sonar Database

Mysql> Create Database sonar Character Set utf8 collate utf8_general_ci;
Mysql> grant all privileges on sonar. * To 'sonar '@' % 'identified by 'sonar ';
Mysql> flush privileges;

5. Modify the confsonar. properties file:
Properties code:
Sonar. JDBC. url: JDBC: mysql: // server IP Address: 3306/sonar? Useunicode = true & characterencoding = utf8
Sonar. JDBC. DRIVER: COM. MySQL. JDBC. Driver
Sonar. JDBC. validationquery: select 1

5. Modify settings. xml of the Maven plug-in on the server and add the following configuration information.

<Profile> <br/> <ID> sonar </ID> <br/> <activation> <br/> <activebydefault> true </activebydefault> <br/> </ activation> <br/> <Properties> <br/> <sonar. JDBC. URL> <br/> JDBC: mysql: // server IP Address: 3306/sonar? Useunicode = true & characterencoding = UTF-8 </P> <p> </sonar. JDBC. URL> <br/> <sonar. JDBC. driver> COM. mySQL. JDBC. driver </sonar. JDBC. driver> <br/> <sonar. JDBC. username> sonar </sonar. JDBC. username> <br/> <sonar. JDBC. password> sonar </sonar. JDBC. password> <br/> <sonar. host. URL> http: // The Server IP Address: 9000 </sonar. host. URL> <br/> </Properties> <br/> </profile> 

 


Sonar plug-in Installation

1. Choose Hudson System Management> plug-in management, as shown in figure

2. Go to "available plug-ins", select the sonar (Hudson sonar plugin) plug-in, and click Install in the lower-right corner of the page, as shown in figure

3. A message is displayed on the page indicating that the sonar plug-in has been installed.

4. Restart Hudson and the plug-in will take effect.

 

Sonar plug-in configuration

1. Choose Hudson> System Management> system configuration, as shown in figure

Http: // 10.20.156.23: 36100/Hudson/configure


2. On the system configuration page, find sonar, for example, the system information for configuring sonar.


3. After completing the above configuration, Hudson + sonar will be integrated.

 

 

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.