赞
踩
在扫描项目时缺少扫描插件
#must be unique in a given SonarQube instance sonar.projectKey=ifc-handheld-webapp:scanner #this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 5.1.2 sonar.projectName=ifc-handheld-webapp-scanner sonar.projectVersion=1.0 #Path is relative to the sonar-project.properties file. Replace "" by "/" on Windows. #Since SonarQube 4.2, this property is optional if sonar.modules is set. #If not set, SonarQube starts looking for source code from the directory containing #the sonar-project.properties file. sonar.sources=. #Encoding of the source code. Default is default system encoding #sonar.sourceEncoding=UTF-8 #添加扫描语言 sonar.language=java
重启服务
${SONAR_HOME}/bin/linux-x86-64/sonar.sh restart
这时会自动下载Java插件包
重新扫描
sonar-scanner
sonar-runner
1. 配置js扫描插件为例
–> download
2. 选择要下载的版本
–> More versions
选择兼容版本
下载地址: https://binaries.sonarsource.com/Distribution/sonar-javascript-plugin/
3. 添加插件
下载完成后将插件添加到 ${SONAR_HOME}/extensions/plugins目录下重启服务
数据库拒绝连接:没有访问root用户的权限
如果使用MySQL数据库报这个错
1. 检查你创建数据库的sql如:
CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'sonar' IDENTIFIED BY 'sonar';
GRANT ALL ON sonar.* TO 'sonar'@'%' IDENTIFIED BY 'sonar';
GRANT ALL ON sonar.* TO 'sonar'@'localhost' IDENTIFIED BY 'sonar';
FLUSH PRIVILEGES;
2. 检查SonarQube配置文件 sonar.properties
用户名:sonar.jdbc.username=sonar
密码:sonar.jdbc.password=sonar
是否都为sonar
#数据库连接配置
sonar.jdbc.username=sonar
sonar.jdbc.password=sonar
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
#根据需求修改默认配置(默认9000端口)
#sonar.web.host=0.0.0.0
#sonar.web.context=
修改对应的jdbc.username与jdbc.password后
重启服务
${SONAR_HOME}/bin/linux-x86-64/sonar.sh restart
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。