前言:在上一篇(SonarQube安装步骤)的基础上,咱们来集成maven/IDEAmysql
1.首先是集成maven(maven的安装配置就很少说了)sql
找到maven安装目录下-conf文件夹-setting.xml文件maven
而后添加如下配置信息:ide
<profile>
<id>sonar</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<sonar.jdbc.url>jdbc:mysql://localhost:3307/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true</sonar.jdbc.url>
<sonar.jdbc.username>root</sonar.jdbc.username>
<sonar.jdbc.password>123456</sonar.jdbc.password>
<sonar.host.url>http://localhost:9000</sonar.host.url>
</properties>
</profile>阿里云
2.项目检测url
保存后,找到须要进行执行代码检测的项目-根目录idea
当看到pom文件时,copy当前路径spa
而后进入CMD,切换到copy的路径下3d
而后输入:mvn sonar:sonar code
或者输入:mvn install sonar:sonar
或者输入:mvn clean install sonar:sonar
3.刷新localhost:9000查看结果(根据我的需求,通常集成maven就能够了,若是须要集成IDEA,咱们就继续下面的操做)
4.修改 maven安装目录下-conf文件夹-setting.xml 文件
添加如下内容:
<!-- 配置本地仓库 -->
<localRepository>D:\path\to\local\repo</localRepository>
<!-- 配置远程maven仓库 -->
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://193.112.160.56:8081/repository/maven-public/</url>
</mirror>
<!-- 配置阿里云私服 -->
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
5.打开IEDA
配置setting-maven
配置setting-sonarLint(须要先下载sonarlint包,再引入)
而后import本地项目,在idea底部就能够看到sonarlint的检测结果了