Static Code analysis tool Sonarqube+sonar-runner installation configuration and use

Source: Internet
Author: User
Tags postgresql

After the successful configuration of the Code Analysis page:

You can see the complexity, syntax usage, repetition, and so on have been analyzed, specific to each method and each sentence of code.

Four modes of use:

Sonarqube + sonar-runnerSonarqube + mavensonarqube + eclipsesonarqube + IDE IntelliJ

Mode of Use 1:Sonarqube + sonar-runner

1. Environment

JDK 1.7

Sonarqube 4.5.7 (the newest sonarqube all require jdk1.8, find a newer version that matches 1.7)

PostgreSQL 9.6.1 (soonarqube4.5.7 requires PostgreSQL to be 8.x or 9.x)

sonar-runner:2.4 (sonarqube4.4+, at least sonar-runner2.4. Sonar-runner renamed to Sonar-scanner after the 2.4 version)

2. Create a database

Create a database sonar locally.

Account Number: Postgres

Password: liyuhui20093357

3. Install, configure, and run Sonarqube

(1) Installation

After downloading, unzip, the installation is successful.

(2) configuration

Modify the Sonar.properties file under the Conf directory.

Database related 2 access path and port related

(3) Environment variables

Sonar_home E:\lyh\software\sonarqube-4.5.7

Path;%sonar_home%\bin;

(4) Operation

Select the folder that matches your computer and run Startsonar.bat.

The Start Success Command box appears with the following prompt:

(5) Visit the homepage

After a successful run, you can access the Sonar home page, and database sonar also has many tables.

Home: Http://localhost:9000/sonar (corresponding to the configuration file)

Out of the table:

(6) Install Chinese plug-in package

There is Chinese pack in the home page, but there is no install button. Had to go to other places themselves under a plug-in package.

After installing the plug-in, restart Sonarqube, and then visit the homepage, it becomes the Chinese page.

4. Install, configure, and run Sonar-runner

(1) Installation

After downloading, unzip, the installation is successful.

(2) configuration

Modify the Sonar-runner.properties file under the Conf directory .

Database related 2 Sonarqube related

(3) Environment variables

Sonar_runner_home E:\lyh\software\sonar-runner-2.4

Path;%sonar_runner_home%\bin;

(4) configuration file for project analysis

Go to the Project home directory and create a new file sonar-project.properties.

The configuration is as follows:

Note that the Language,sonar-runner here have detailed formatting and are case-sensitive, so writing Java will make an error.

(5) Operation

Enter the project's home directory and run the command:sonar-runner

Analyze Project success:

5. View Analysis Results

Access path: Http://localhost:9000/sonar (matches configuration file)

Select an item in the home page, select AAs in the project, and then you can view each analysis result.

Static Code analysis tool Sonarqube+sonar-runner installation configuration and use

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.