1 mvn的setting配置文件中配置如下
其中sonar.host.url是本地或者服务器上自己安装的sonar
	<pluginGroups>
			<pluginGroup>org.sonarsource.scanner.maven</pluginGroup>
	</pluginGroups>
			<profile>
		 <id>sonar</id>
		 <activation>
		   <activeByDefault>true</activeByDefault>
		 </activation>
		 <properties>
		   <sonar.host.url> http://ip:9080</sonar.host.url>
		 </properties>
		</profile>
 
2 在项目文件夹中打开cmd然后输入命令
mvn sonar:sonar
 
3 查看如图




















