1.安装

数据库请自信百度安装,本文不做介绍

sonarqube-7.3 大家自行百度下载

解压安装:
# unzip sonarqube-7.3.zip
# mv sonarqube-7.3 sonarqube
编辑 sonar 配置:
# cd sonarqube/conf/
# vi sonar.properties
sonar.jdbc.username=***
sonar.jdbc.password=***
#—– MySQL 5.x
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonarqube?useUnicode=true&characterE
ncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
sonar.web.host=0.0.0.0
sonar.web.context=/sonarqube
sonar.web.port=9090
保存以上配置(注意,要看看默认的 9000 端口是否已被占用)
防火墙中打开 9090 端口:
# vi /etc/sysconfig/iptables
-A INPUT -m state –state NEW -m tcp -p tcp –dport 9090 -j ACCEPT
重启防火墙,使端口配置生效
# service iptables restart
启动 SonarQube Web Server
# /root/sonarqube/bin/linux-x86-64/sonar.sh start
(初次启动会自动建表和做相应的初始化)
浏览器中输入:http://*.*.*.*:9090/sonarqube/
 

 

 

 

登录 默认账号密码 admin:admin

汉化

 

搜索 chinese Pack  安装完成后 重启sonar

# /root/sonarqube/bin/linux-x86-64/sonar.sh restart
Stopping SonarQube…
Stopped SonarQube.
Starting SonarQube…
Started SonarQube.

 

2.maven安装(自行百度)

1.首先是集成maven(maven的安装配置就不多说了)

找到maven安装目录下-conf文件夹-setting.xml文件

然后添加以下配置信息:

<profile>
<id>sonar</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<sonar.jdbc.url>
jdbc:mysql://mysql://****:3306/sonarqube?useUnicode=true&amp;characterEncoding=utf8
</sonar.jdbc.url>
<sonar.jdbc.driver>com.mysql.jdbc.Driver</sonar.jdbc.driver>
<sonar.jdbc.username>**</sonar.jdbc.username>
<sonar.jdbc.password>***</sonar.jdbc.password>
<sonar.host.url>http://***:9000/sonarqube/</sonar.host.url>
</properties>
</profile>

 

2.修改 maven安装目录下-conf文件夹-setting.xml 文件

添加以下内容:

 <!– 配置本地仓库 –>
 <localRepository>D:\path\to\local\repo</localRepository>
   

 <!– 配置阿里云私服 –>
         <mirror>    
           <id>nexus-aliyun</id>    
           <mirrorOf>*</mirrorOf>    
           <name>Nexus aliyun</name>    
           <url>http://maven.aliyun.com/nexus/content/groups/public</url>    
        </mirror>

3.pom.xml

<plugin>
  <groupId>org.sonarsource.scanner.maven</groupId>
  <artifactId>sonar-maven-plugin</artifactId>
  <version>3.1.1</version>
</plugin>
等待下载完成

4.安装 sonarLint插件

File –>settings 找到 plugins 搜索 sonarLint 点击 Browse

 

 

 

 

安装完成后

 

2.添加sonar服务器连接

3.选择连接到服务,填入名称和服务地址

4.next填写账号密码。这一步就不截图了

 

 

 

 

 

 

版权声明:本文为liujun-dqw原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/liujun-dqw/p/12973326.html