1、下载安装SonarQube 5.3,直接解压,修改conf中的properties文件中的数据库的配置,运行bin中的
StartSonar.bat即可;访问
http://localhost:9000/能看到效果;
2、安装maven的Sonar-scanner插件,具体操作如下:就可以将maven的运行结果,和jacoco的分析结果上传进行分析:(关于Sonar-runner的文章,已经过时了)
(运行正常!整合的jacoco的测试覆盖率,还有一个新的插件,第一次发现本地没有回去中央仓库下载,第二次,就用上一次下载下来的了。)
Initial Setup
Global Settings
Edit the settings.xml file, located in $MAVEN_HOME/conf or ~/.m2, to set the plugin prefix and optionally the SonarQube server URL.
Example:
<
settings
>
<
pluginGroups
>
<
pluginGroup
>org.sonarsource.scanner.maven</
pluginGroup
>
</
pluginGroups
>
<
profiles
>
<
profile
>
<
id
>sonar</
id
>
<
activation
>
<
activeByDefault
>true</
activeByDefault
>
</
activation
>
<
properties
>
<!-- Optional URL to server. Default value is http://localhost:9000 -->
<
sonar.host.url
>
</
sonar.host.url
>
</
properties
>
</
profile
>
</
profiles
>
</
settings
>
|
Analyzing a Maven Project
Analyzing a Maven project consists of running a Maven goal: sonar:sonar
in the directory where the pom.xml file sits.
mvn clean verify sonar:sonar
# In some situation you may want to run sonar:sonar goal as a dedicated step. Be sure to use install as first step for multi-module projects
mvn clean install
mvn sonar:sonar
|