Continuous integration-Platform build (Hudson+sonar)

Source: Internet
Author: User
Tags create database

H Udson is an extensible, continuous integration engine. Mainly used for: continuously, automatically build/test software projects. Monitor some tasks that are scheduled to be performed.

Sonar is an open source quality management platform, focusing on the continuous analysis and measurement of technical quality from project to class method, which integrates code quality related software into a unified management;

In simple terms,

Hudson is a continuous, automated build/test software project,

The sonar is the continuous, automatic statistics and analysis of software project related quality data, such as unit test pass rate, coverage, the complexity of the code, the number of lines of code, etc., 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 (it is packaged as a WAR file). Hudson Official website: http://hudson-ci.org/

2) Run Java-jar Hudson.war

Note: Hudson needs to run the Java 5 and above versions.

Another way to install it is to deploy the downloaded War package file to the servlet container, and then start the container and enter an address like http://localhost:8088/hudson/in the URL address bar of the browser. The following figure is the successful installation of the interface (using the XP+TOMCAT+JAVA5 environment):

2, start: Access to the server directory/home/user name/apache-tomcat-6.0.20/bin

Execute script shutdown.sh or startup.sh for reuse or deactivation

3. System Configuration:

On the Hudson home page, click on the left side of the system Management-> system settings:

On the System Configuration page, the first item in this list shows the home directory . This contains all the workspaces that Hudson will perform and all the configurations that store it.

To configure a JDK and Maven2 instance, click the Add button below each section to add the name and absolute address of the instance.

It is recommended not to check the install automatically option, but to enter the user's native Java, maven2 installation path and naming.

Again, describe what other text information on the page means:

System.message fill in some explanatory information
Quiet Period:hudson time to build the project (seconds)
Enable Security: Set the rules for Hudson login (anonymous login by default), as described below
TCP port for JNLP slave agents: Do not understand JNLP dare not to write in short is three ways: stationary (fixed) random (Radom) do not use (disabled), use fixed time can be filled in the JNLP information

Security Realm: You can use middleware containers, databases, and LDAP to authenticate safety.

Authorized: You can set authentication methods for your identity: System users, anonymous users, custom users, and inherited users (also in the study, we recommend using anonymous users)
JDK installations: Setting up the JDK installation path
Shell executable: Set window shell command
Ant installation: Setting an ant installation path
Mave installation Set the Mave installation path
CVS executable: Sets the path of the cvsnt execution process (Cvs.exe)
. cvspass file: Set the path to the CVSNT administrator file (passwd files)
e-mail Notification: Set the mailbox address that is sent when an error occurs
Hudson URL: Hudson's default address.

You can also configure several other aspects of the server, such as providing Hudson with the location of an e-mail server to receive e-mail when the build fails. Depending on how e-mail is set up for your organization, you may need to have your system administrator help set this feature. Setting up e-mail is not required; Hudson also supports RSS as a notification mechanism, which for some people is better than email. It is up to you exactly which notification mechanism to choose.

Build:

1. Download
Download Sonar's compressed package to the official website and extract it to any directory http://www.sonarsource.org/downloads/

2. Mysql Database Installation

Go to no SQL official download MySQL's RPM package on the Web: 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. Login MySQL, MySQL's initial username password is root/empty

Normal login for Mysql–u sonar–p sonar

4. Create a Database

Sonar default to use the embedded Derby database, if you want to migrate to MySQL, you need to first create a sonar/sonar UTF-8 MySQL database, and authorized access to the Sonar library

Mysql> CREATE DATABASE sonar CHARACTER SET UTF8 COLLATE utf8_general_ci;
Mysql> grant all privileges in sonar.* to ' sonar ' @ '% ' identified by ' sonar ';
mysql> flush Privileges;

5. To 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 the server's Maven plugin settings. XML, you can add the following configuration information

<profile> <id>sonar</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <sonar.jdbc.url> jdbc:mysql://server IP address: 3306/sonar?useunicode=true &characterencoding=utf-8 </sonar.jdbc.url> <sonar.jdbc.driver>com.mysql.jdbc.driver</ Sonar.jdbc.driver> <sonar.jdbc.username>sonar</sonar.jdbc.username> <sonar.jdbc.password> sonar</sonar.jdbc.password> <sonar.host.url>http://Server IP address:9000</sonar.host.url> </ Properties> </profile>

installation of Sonar Plug-ins

1, into the Hudson System Management-> plug-in management, the following figure


2, into the "Available Plug-ins", select Sonar (Hudson Sonar Plugin) Plug-ins, in the lower right corner of this page (the bottom) Click Installation, the following figure


3, the page prompts the success, namely identifies completes the Sonar plug-in installation

4, restart Hudson, plug-ins on the entry into force.

Sonar plug-in configuration

1, into the hudson-> system Management-> system configuration, the following figure

Http://10.20.156.23:36100/hudson/configure


2, in the "System Configuration" page to find sonar, the following figure, configure sonar System Information


3, finish the above configuration, Hudson+sonar integration.

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.