解決Jenkins集成SonarQube遇到的報錯問題
Jenkins集成Sonar過程中遇到的報錯
1、jenkins中無法添加sonarqube的token憑證
因為添加的憑證類型錯誤,所以無法添加token,類型應(yīng)該選擇“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 生產(chǎn)模式要求和文件描述符配置。 解決:在 Linux 上,您可以通過在主機上以 root 身份運行以下命令來設(shè)置當(dāng)前會話的推薦值:(調(diào)整系統(tǒng)參數(shù)) sysctl -w vm.max_map_count=262144 sysctl -w fs.file-max=65536 ulimit -n 65536 ulimit -u 4096
3、es程序在sonarqube目錄下找不到j(luò)ava(或者沒有定義java環(huán)境變量)
#完整報錯:
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數(shù)據(jù)庫
#完整報錯:
Exception in thread "main" org.sonar.process.MessageException: Unsupported JDBC driver provider: mysql原因:sonarqube7.9以上已不再支持mysql數(shù)據(jù)庫
解決:換成postgresql、oracle、sqlserver數(shù)據(jù)庫
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參數(shù)
解決:在Analysis properties配置中添加 ”sonar.java.binaries“ 參數(shù)

到此這篇關(guān)于Jenkins集成SonarQube遇到的報錯的文章就介紹到這了,更多相關(guān)Jenkins集成SonarQube報錯內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Java基于LoadingCache實現(xiàn)本地緩存的示例代碼
本文主要介紹了Java基于LoadingCache實現(xiàn)本地緩存的示例代碼,文中通過示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下2022-01-01
Java中轉(zhuǎn)義字符反斜杠\的代替方法及repalceAll內(nèi)涵解析
這篇文章主要介紹了Java中轉(zhuǎn)義字符反斜杠\的代替方法及repalceAll內(nèi)涵解析,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-08-08
spring security登錄認(rèn)證授權(quán)的項目實踐
SpringSecurity主要實現(xiàn)了認(rèn)證(Authentication)和授權(quán)(AccessControl),本文就來介紹一下spring security登錄認(rèn)證授權(quán)的項目實踐,感興趣的可以了解一下2025-01-01
關(guān)于SpringCloud?Ribbon替換輪詢算法問題
Spring?Cloud?Ribbon是基于Netlix?Ribbon實現(xiàn)的一套客戶端負(fù)載均衡的工具。接下來通過本文給大家介紹SpringCloud?Ribbon替換輪詢算法問題,需要的朋友可以參考下2022-01-01
SpringBoot整合Hmily實現(xiàn)TCC分布式事務(wù)
這篇文章主要為大家詳細(xì)介紹了SpringBoot如何整合Hmily實現(xiàn)TCC分布式事務(wù),文中的示例代碼講解詳細(xì),感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下2024-11-11

