当前位置: 移动技术网 > IT编程>数据库>Mysql > SonarQube 安装及配置方法

SonarQube 安装及配置方法

2018年02月04日  | 移动技术网IT编程  | 我要评论

thanks

下载sonarqube-6.4

下载SonarQube Scanner

mysql增加名为sonar的数据库,增加用户sonarqube@sonarqube

将SonarQube解压后修改配置文件的数据库配置和用户配置

[root@localhost pig]# vim sonarqube-6.4/conf/sonar.properties

# 配置数据库用户名和密码
sonar.jdbc.username=sonarqube
sonar.jdbc.password=sonarqube

# 打开下面这行的注释
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false
sonar.web.port=9000

启动SonarQube后访问http://ip:9000

[root@localhost pig]# cd sonarqube-6.4/bin/linux-x86-64/
[root@localhost linux-x86-64]# ./sonar.sh start

安装中文插件等

管理员区域里搜索 chinese Pack 插件,安装并重启

SonarQube Scanner 配置文件

# vim sonar-scanner/conf/sonar-scanner.properties

#Configure here general information about the environment, such as SonarQube DB details for example
#No information about specific project should appear here

#----- Default SonarQube server
sonar.host.url=http://localhost:9000

#----- Default source code encoding
sonar.sourceEncoding=UTF-8

sonar.login=admin
sonar.password=admin
sonar.scm.disabled=true

sonar-project.properties

这个我就不写了

执行sonar-scanner

如果执行时内存不够用则修改下配置

 vim /usr/local/sonarqube/sonar-scanner/bin/sonar-scanner

exec "$java_cmd" \
  -Djava.awt.headless=true \
  $SONAR_SCANNER_OPTS \
  $SONAR_SCANNER_DEBUG_OPTS \
  -classpath  "$jar_file" \
  -Dscanner.home="$sonar_scanner_home" \
  -Dproject.home="$project_home" \
  -Xms256m \
  -Xmx1024m \
  org.sonarsource.scanner.cli.Main "$@"

问题汇总

Failed to upload report - 500: An error has occurred

这是为mysql配置问题
需要修改mysql配置

[mysqld]
max_allowed_packet = 32M

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网