Step 1: Configure in Maven->setting.xml
Modify the Setting.xml file used by the MVN project and add it to the <profiles></profiles> node:
<profile> <id>sonar</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <sonar.jdbc.url> jdbc:mysql://${mysql-url}:${port}/${DbName}?useUnicode=true&characterEncoding=utf8 </sonar.jdbc.url> <sonar.jdbc.username>${name}</sonar.jdbc.username> <sonar.jdbc.password>${passwd}</sonar.jdbc.password> <sonar.host.url>${url}</sonar.host.url> </properties> </profile>
Step 2:
Then, execute the command mvn clean install Sonar:sonar
-
The Maven plugin automatically uploads the required data (such as unit test results, static test results, and so on) to the Sonar server
After execution is complete, you can view the analysis results data in the Web server
Reference
Http://www.07net01.com/program/102648.html
http://blog.csdn.net/hunterno4/article/details/11687269
Http://www.cnblogs.com/gao241/p/3190701.html
The way Java+maven works to run sonar