我正在使用Jenkins,在构建部分我执行Sonar Execute Scanner。这些都是我的属性
sonar.projectKey=PSKAS
sonar.projectName=PSKAS_CODE
sonar.projectVersion=1.0
sonar.analysis.mode=publish
sonar.sources=PSKAS/web,PSKAS/src
sonar.qualitygate=PSKAS_JAVA
sonar.libraries=lib
sonar.tests=\PSKAS\PSKAS_test_cases
sonar.issuesReport.html.enable=true
sonar.issuesReport.html.location=$WORKSPACE/
sonar.issuesReport.console.enable=true
sonar.includePlugins=views,report
sonar.issuesReport.console.enable=true
sonar.sourceEncoding=UTF-8
sonar.buildbreaker.skip=false
但是收到这样的错误,无法修复
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:53)
Caused by: You must define the following mandatory properties for 'PSKAS': sonar.projectName
ERROR:
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
Build step 'Execute SonarQube Scanner' marked build as failure
[BFA] Scanning build for known causes...
[BFA] No failure causes found
[BFA] Done. 0s
答案 0 :(得分:0)
在我的情况下添加属性:
sonar.projectKey=XXX
sonar.projectName=YYY
sonar.projectVersion=ZZZ
到jenkins分析属性解决了问题。