sonar configuration management one

  sonar is an open source code quality static check tool. Use sonar to check test coverage, code complexity, duplicate code, and bad programming style that violates certain rules.

 

For maven configuration see: http://xjward.iteye.com/blog/1909092

Download sonar : http://www.sonarqube.org/downloads/  download version 3.5.1 and extract it to D:\Program Files\sonar-3.5.1

 

To start sonar using maven, you need to add the sonar configuration under the profiles node in setting.xml in the .m2 directory

C:\Users\Administrator\.m2\setting.xml

<profile>
	<id>sonar</id>
	<activation>
		<activeByDefault>true</activeByDefault>
	</activation>
	<properties>
		<sonar.jdbc.url>jdbc:oracle:thin:@172.19.121.142:1521/orcl
		</sonar.jdbc.url>
		<sonar.jdbc.driverClassName>oracle.jdbc.driver.OracleDriver
		</sonar.jdbc.driverClassName>
		<sonar.jdbc.username>scott
		</sonar.jdbc.username>
		<sonar.jdbc.password>tiger
		</sonar.jdbc.password>
		<sonar.host.url>http://172.19.121.142:8082/</sonar.host.url>
	</properties>
</profile>

 

 

Sonar's inspection information for the project is stored in the database, so it is necessary to configure the corresponding database mysql, oracel, db2, etc.

D:\Program Files\sonar-3.5.1\conf\sonar.properties

sonar.web.host:                           172.19.121.142
sonar.web.port:                           8082
sonar.web.context:                        /
sonar.jdbc.username:                       scott
sonar.jdbc.password:                       tiger
sonar.jdbc.url:                             jdbc:oracle:thin:@172.19.121.142:1521/orcl
sonar.jdbc.driverClassName:                oracle.jdbc.OracleDriver
sonar.jdbc.maxActive:                      20
sonar.jdbc.maxIdle:                        5
sonar.jdbc.minIdle:                        2
sonar.jdbc.maxWait:                        5000
sonar.jdbc.minEvictableIdleTimeMillis: 600000
sonar.jdbc.timeBetweenEvictionRunsMillis: 30000
sonar.notifications.delay=60

 The link mode of db is configured, of course, the corresponding rack package is also required.

 

Put ojdbc14-10.2.jar into D:\Program Files\sonar-3.5.1\extensions\jdbc-driver\oracle directory;

 

First enable sonar in D:\Program Files\sonar-3.5.1\bin\windows-x86-32\:

Add windows service InstallNTService.bat 

Start the service StartNTService.bat

Start sonar StartSonar.bat

After successful startup, visit sonar's homepage http://172.19.121.142:8082

 

 In the root directory of the project E:\workspace\MDM

 Press the Shift key on the keyboard and click the right mouse button to select 'Open command window here (W)'

Execute the mvn sonar:sonar command to add the project MDM to the sonar service

 

Refresh http://172.19.121.142:8082  to see the project MDM.

 

 

postscript:

         mvn sonar:sonar has the problem   of Chinese garbled characters

  If the system encoding is GBK but the project encoding is UTF-8: add a node in the properties item of pom.xml

 

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

 

 Download the compressed package sonar_Zh.rar for the prompt information of the Chinese sonar check rules

 

 

 

 

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326865765&siteId=291194637