Jenkins Sonar integration

Sonar version: 5.3

 

Background: The CTO plans to use Sonar to automatically identify low-level errors in programmers' code in the future. Adopt the way of Jeknis+Sonar collection.

 

Rough description of the solution:

1) The Sonar database uses MySQL and is currently built on the db test server 90.

2) Sonar is built on the test server 192.168.1.150.

 

step:

step1:

Place the following configuration in the maven.settings file. If the format is not clear, you can also directly refer to the settings.xml in the attachment.

<!-- Plugin configuration -->

<pluginGroups>   

  <!-- sonar settings-->   

  <pluginGroup>org.sonarsource.scanner.maven

  </pluginGroup>  

</pluginGroups>

 

<!-- profile配置 -->
<profiles>

<profile>     

<id>sonar</id>     

<activation>         

<activeByDefault>true</activeByDefault>     

</activation>   

<properties>        

<sonar.jdbc.url>jdbc:mysql://192.168.1.90:3306/sonar?useUnicode=true&characterEncoding=utf8</sonar.jdbc.url> <sonar.jdbc.driver>com.mysql.jdbc.Driver</sonar.jdbc.driver>                  

<sonar.jdbc.username>nonobank</sonar.jdbc.username>         

<sonar.jdbc.password>nonobank!@#</sonar.jdbc.password>         

<sonar.host.url>http://192.168.1.150:9000</sonar.host.url>    

</properties> 

</profile>

</profiles>

 

step2:

Configure the maven command in jenkins as follows:

1)clean verify sonar:sonar

2)  clean install

3) sound: sound

 

Above, the configuration is complete.

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326522041&siteId=291194637