解决Jenkins集成SonarQube遇到的报错问题
作者:等风来~~ 时间:2023-11-24 08:54:10
Jenkins集成Sonar过程中遇到的报错
1、jenkins中无法添加sonarqube的token凭证
因为添加的凭证类型错误,所以无法添加token,类型应该选择“Secret text”,而不是“username with password”。
2、启动sonarqube报错
#完整报错:
ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch.
bootstrap check failure [1] of [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
ERROR: Elasticsearch did not exit normally - check the logs at /opt/sonarqube/logs/sonarqube.log
原因:由于 SonarQube 使用嵌入式 Elasticsearch,请确保您的 Docker 主机配置符合Elasticsearch 生产模式要求和文件描述符配置。
解决:在 Linux 上,您可以通过在主机上以 root 身份运行以下命令来设置当前会话的推荐值:(调整系统参数)
sysctl -w vm.max_map_count=262144
sysctl -w fs.file-max=65536
ulimit -n 65536
ulimit -u 4096
3、es程序在sonarqube目录下找不到java(或者没有定义java环境变量)
#完整报错:
2021.07.12 05:59:54 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
could not find java in ES_JAVA_HOME at /opt/java/openjdk/bin/java
2021.07.12 05:59:54 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 1
2021.07.12 05:59:54 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
原因:因为用的是sonarqube:9.0.0-community最新版,可能是sonar版本问题(没弄明白)
解决:换个低版本就不会有这个问题了,比如sonarqube:8.9.1-conmunity版本
4、sonarqube高版本不支持mysql数据库
#完整报错:
Exception in thread "main" org.sonar.process.MessageException: Unsupported JDBC driver provider: mysql原因:sonarqube7.9以上已不再支持mysql数据库
解决:换成postgresql、oracle、sqlserver数据库
5、jenkins项目中配置sonarqube Scanner 报错
#完整报错:
ERROR: Tasks support was removed in SonarQube 7.6.
ERROR:
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succeed?
ERROR: SonarQube scanner exited with non-zero code: 2解决:删除Execute SonarQube Scanner中Task to run这一栏,什么东西都不要填
#完整报错
org.sonar.java.AnalysisException: Your project contains .java files, please provide compiled classes with sonar.java.binaries property,
or exclude them from the analysis with sonar.exclusions property.原因:sonarqube的sonar-java插件从4.1.2开始,强制要求sonar.java.binaries参数
解决:在Analysis properties配置中添加 ”sonar.java.binaries“ 参数
来源:https://www.cnblogs.com/cfzy/p/15011679.html
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
如何基于FTP4J实现FTPS连接过程解析
![](https://img.aspxhome.com/file/2023/5/80315_0s.jpg)
Java运行时数据区域(内存划分)的深入讲解
![](https://img.aspxhome.com/file/2023/8/94298_0s.png)
c#实现sqlserver事务处理示例
Java实现年兽大作战游戏详解
![](https://img.aspxhome.com/file/2023/5/58875_0s.jpg)
Java创建型设计模式之建造者模式详解
java启动jar包修改JVM默认内存问题
![](https://img.aspxhome.com/file/2023/5/103985_0s.png)
java编程题之顺时针打印矩阵
Java异常处理机制try catch流程详解
![](https://img.aspxhome.com/file/2023/4/62404_0s.png)
Android更多条目收缩展开控件ExpandView的示例代码
![](https://img.aspxhome.com/file/2023/6/126716_0s.gif)
Spring Boot 动态数据源示例(多数据源自动切换)
JAVA SFTP文件上传、下载及批量下载实例
WebView的几个常见功能使用方法
java多线程下载实例详解
![](https://img.aspxhome.com/file/2023/9/116179_0s.png)
Spring Boot2深入分析解决java.lang.ArrayStoreException异常
![](https://img.aspxhome.com/file/2023/6/67436_0s.jpg)
Java根据模板导出Excel报表并复制模板生成多个Sheet页
![](https://img.aspxhome.com/file/2023/5/69875_0s.png)
MyBatis JdbcType 与Oracle、MySql数据类型对应关系说明
![](https://img.aspxhome.com/file/2023/6/58276_0s.jpg)
Java中tomcat memecached session 共享同步问题的解决办法
![](https://img.aspxhome.com/file/2023/9/78019_0s.png)
详解Android 7.0 Settings 加载选项
![](https://img.aspxhome.com/file/2023/5/137445_0s.png)
Android 文件下载三种基本方式
Mybatis映射文件规则实例详解
![](https://img.aspxhome.com/file/2023/3/125313_0s.jpg)