我想为詹金斯执行“ SonarQube扫描仪”
但是现在 这是配置文件: 执行后,显示错误
**-Dsonar.projectKey=Hotel \
-Dsonar.host.url=http://23.101.**** \
-Dsonar.login=4df48c69cc5a8783a5443a5af84824******
sonar.login=admin
sonar.password=******
sonar.verbose=true
sonar.language=java
sonar.sources=/var/lib/jenkins/workspace/$JOB_NAME/
sonar.sourceEncoding=UTF-8
sonar.exclusions= src
sonar.projectVersion=1.0**
Running as SYSTEM
Building in workspace /var/lib/jenkins/workspace/Hotel_API
using credential 27c26c58-35d2-46dc-8872-606bae698be6
git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
git config remote.origin.url https://gitlab.com/tunv15/hotel-api.git # timeout=10
Fetching upstream changes from https://gitlab.com/tunv15/hotel-api.git
git --version # timeout=10
using GIT_ASKPASS to set credentials
git fetch --tags --progress https://gitlab.com/tunv15/hotel-api.git
+refs/heads/*:refs/remotes/origin/*
git rev-parse refs/remotes/origin/master^{commit} # timeout=10
git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision 4460a9b58f517d823e8773df51a0564bb2fe6673 (refs/remotes/origin/master)
git config core.sparsecheckout # timeout=10
git checkout -f 4460a9b58f517d823e8773df51a0564bb2fe6673
Commit message: "Update HOTEL-API_sonar-project.properties"
git rev-list --no-walk 4460a9b58f517d823e8773df51a0564bb2fe6673 # timeout=10
Injecting SonarQube environment variables using the configuration: Hotel_API
[Hotel_API] $ /var/lib/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/Hotel_API/bin/sonar-scanner Sonar -D-X -Dsonar.host.url=http://23.101.****
-Dsonar.sourceEncoding=UTF-8 -Dsonar.sources=/var/lib/jenkins/workspace/Hotel_API/ -Dsonar.language=java -Dsonar.login=admin -Dsonar.exclusions=src/** "-D-Dsonar.projectKey=Hotel -Dsonar.host.url=http://23.10***
-Dsonar.login=4df48c69cc5a8783a5443a5af84*****" -Dsonar.projectVersion=1.0 -Dsonar.verbose=true -Dsonar.password=**** -Dsonar.projectBaseDir=/var/lib/jenkins/workspace/Hotel_API
INFO: Scanner configuration file: /var/lib/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/Hotel_API/conf/sonar-scanner.properties
INFO: Project root configuration file: /var/lib/jenkins/workspace/Hotel_API/sonar-project.properties
04:08:56.184 INFO: SonarQube Scanner 4.0.0.1744
04:08:56.186 INFO: Java 9.0.4 Oracle Corporation (64-bit)
04:08:56.186 INFO: Linux 4.15.0-1055-azure amd64
04:08:56.369 DEBUG: keyStore is :
04:08:56.369 DEBUG: keyStore type is : pkcs12
04:08:56.369 DEBUG: keyStore provider is :
04:08:56.369 DEBUG: init keystore
04:08:56.370 DEBUG: init keymanager of type SunX509
04:08:56.507 DEBUG: Create: /var/lib/jenkins/.sonar/cache
04:08:56.507 INFO: User cache: /var/lib/jenkins/.sonar/cache
04:08:56.508 DEBUG: Create: /var/lib/jenkins/.sonar/cache/_tmp
04:08:56.510 DEBUG: Extract sonar-scanner-api-batch in temp...
04:08:56.513 DEBUG: Get bootstrap index...
04:08:56.513 DEBUG: Download: http://23.101.9.197/batch/index
04:08:56.565 DEBUG: Get bootstrap completed
04:08:56.570 DEBUG: Create isolated classloader...
04:08:56.604 DEBUG: Start temp cleaning...
04:08:56.610 DEBUG: Temp cleaning done
04:08:56.610 DEBUG: Execution getVersion
04:08:56.621 INFO: SonarQube server 7.9.1
04:08:56.622 DEBUG: Execution execute
04:08:56.877 WARN: SonarScanner will require Java 11+ to run starting in SonarQube 8.x
04:08:56.879 DEBUG: Community 7.9.1.27448
04:08:56.976 INFO: Load global settings
04:08:57.622 DEBUG: GET 200 http://23.101.9.197/api/settings/values.protobuf | time=645ms
04:08:57.652 INFO: Load global settings (done) | time=676ms
04:08:57.655 INFO: Server id: 32FADB56-AWviJsnh2_A_tHfY_aqj
04:08:57.685 INFO: User cache: /var/lib/jenkins/.sonar/cache
04:08:57.692 INFO: Load/download plugins
04:08:57.694 INFO: Load plugins index
04:08:58.304 DEBUG: GET 200 http://23.101.9.197/api/plugins/installed | time=609ms
04:08:58.347 INFO: Load plugins index (done) | time=653ms
04:08:58.400 INFO: Load/download plugins (done) | time=708ms
04:08:58.460 DEBUG: Plugins:
04:08:58.460 DEBUG: * SonarPython 1.14.0.3086 (python)
04:08:58.460 DEBUG: * SonarCSS 1.1.1.1010 (cssfamily)
04:08:58.460 DEBUG: * GitHub Authentication for SonarQube 1.5.0.870 (authgithub)
04:08:58.460 DEBUG: * JaCoCo 1.0.2.475 (jacoco)
04:08:58.460 DEBUG: * SonarGo 1.1.1.2000 (go)
04:08:58.460 DEBUG: * SonarKotlin 1.5.0.315 (kotlin)
04:08:58.460 DEBUG: * Svn 1.9.0.1295 (scmsvn)
04:08:58.461 DEBUG: * SonarJS 5.2.1.7778 (javascript)
04:08:58.461 DEBUG: * SonarRuby 1.5.0.315 (ruby)
04:08:58.461 DEBUG: * SonarScala 1.5.0.315 (sonarscala)
04:08:58.461 DEBUG: * SonarC# 7.15.0.8572 (csharp)
04:08:58.461 DEBUG: * SonarJava 5.13.1.18282 (java)
04:08:58.461 DEBUG: * LDAP 2.2.0.608 (ldap)
04:08:58.462 DEBUG: * SonarHTML 3.1.0.1615 (web)
04:08:58.462 DEBUG: * Git 1.8.0.1574 (scmgit)
04:08:58.462 DEBUG: * SonarFlex 2.5.1.1831 (flex)
04:08:58.462 DEBUG: * SonarXML 2.0.1.2020 (xml)
04:08:58.462 DEBUG: * SAML 2.0 Authentication for SonarQube 1.1.0.181 (authsaml)
04:08:58.462 DEBUG: * SonarPHP 3.2.0.4868 (php)
04:08:58.462 DEBUG: * SonarTS 1.9.0.3766 (typescript)
04:08:58.462 DEBUG: * SonarVB 7.15.0.8572 (vbnet)
04:08:58.488 INFO: ------------------------------------------------------------------------
04:08:58.488 INFO: EXECUTION FAILURE
04:08:58.488 INFO: ------------------------------------------------------------------------
04:08:58.488 INFO: Total time: 2.372s
04:08:58.519 INFO: Final Memory: 6M/21M
04:08:58.519 INFO: ------------------------------------------------------------------------
04:08:58.519 ERROR: Error during SonarQube Scanner execution
04:08:58.519 ERROR: Tasks support was removed in SonarQube 7.6.
04:08:58.519 ERROR:
04:08:58.519 ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succeeded?
WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succeeded?
ERROR: SonarQube scanner exited with non-zero code: 2
Finished: FAILURE
答案 0 :(得分:0)
您的命令以 sonar-scanner Sonar
开头。从参数列表中删除单词 Sonar
。
所有参数都应以 -
开头。请在此处查看工具和参数的文档:https://docs.sonarqube.org/latest/analysis/scan/sonarscanner/