#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://10.17.10.34:9000/ #----- PostgreSQL #sonar.jdbc.url=jdbc:postgresql://localhost/sonar #----- MySQL sonar.jdbc.url=jdbc:mysql://10.117.150.34:33306/sonardb?useUnicode=true&characterEncoding=utf8 #----- Oracle #sonar.jdbc.url=jdbc:oracle:thin:@localhost/XE #----- Microsoft SQLServer #sonar.jdbc.url=jdbc:jtds:sqlserver://localhost/sonar;SelectMethod=Cursor #----- Global database settings sonar.jdbc.username=sonarqube sonar.jdbc.password=Sonarqube #----- Default source code encoding sonar.sourceEncoding=UTF-8 #----- Security (when 'sonar.forceAuthentication' is set to 'true') sonar.login=admin sonar.password=admin
把sonar-runner添加到path环境变量:
# .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin export PATH=$PATH:/usr/local/go/bin export PATH=$PATH:/usr/local/sonar-runner-2.4/bin export GOPATH=/root/go export PATH
运行sonar-runner可能会报错:
unable to execute sonar
Failed to upload report - 500: An error has occurred. Please contact your administrator
大多是因为MySQL需要设置数据库允许接收的最大包,
mysql客户端命令行执行
set
global
max_allowed_packet =100*1024*1024;
show VARIABLES like ‘%max_allowed_packet%‘; 查看 max_allowed_packet收更新成功
然后重启sonar服务器