当前位置:   article > 正文

SonarQube部署、运行常见错误解决_request was redirected, please provide the correct

request was redirected, please provide the correct url

Sonar Error - Can not execute Sonar: You must install a plugin that supports the language ‘java’

在扫描项目时缺少扫描插件

检查路径 ${SONAR_HOME}/extensions/plugins 中是否有扫描插件

1. 有对应插件:则查看项目根路径 sonar-project.properties 配置文件
#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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 添加扫描路径 sonar.sources=.
  • 添加扫描语言 sonar.language=java
2. 没有对应插件:将SonarQube服务初始化时在数据库创建的表全部删除或 删除数据库

重启服务

${SONAR_HOME}/bin/linux-x86-64/sonar.sh restart
  • 1

这时会自动下载Java插件包

重新扫描

sonar-scanner
sonar-runner
  • 1
  • 2
插件配置(手动配置)

1. 配置js扫描插件为例
–> download
这里写图片描述

2. 选择要下载的版本
这里写图片描述

–> More versions
选择兼容版本
这里写图片描述

下载地址: https://binaries.sonarsource.com/Distribution/sonar-javascript-plugin/

3. 添加插件
下载完成后将插件添加到 ${SONAR_HOME}/extensions/plugins目录下重启服务

Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user ‘root’@‘localhost’ (using password: NO))

数据库拒绝连接:没有访问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;
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

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=
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

修改对应的jdbc.username与jdbc.password后

重启服务

${SONAR_HOME}/bin/linux-x86-64/sonar.sh restart
  • 1
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/爱喝兽奶帝天荒/article/detail/973036
推荐阅读
相关标签
  

闽ICP备14008679号