See*_*pha 36 batch-file sonarqube
学习如何使用SonarQube并从这里快速安装
一直到第5步.执行时我的构建失败:C:\ sonar-runner\bin\sonar-runner.bat
我收到以下错误:
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 7.572s
Final Memory: 8M/223M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: You must define the following mandatory properties for 'Unknown': sonar.projectKey, sonar.projectName, sonar.projectVersion, sonar.sources
ERROR:
ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with the -e switch.
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
Run Code Online (Sandbox Code Playgroud)
有人遇到过类似的情况并解决了吗?
alb*_*iff 70
如果您有一个java项目,则必须在执行sonar runner的文件夹中创建一个sonar-project.properties文件.您必须在此文件中定义以下属性:
# Required metadata
sonar.projectKey=java-sonar-runner-simple
sonar.projectName=Simple Java project analyzed with the SonarQube Runner
sonar.projectVersion=1.0
# Comma-separated paths to directories with sources (required)
sonar.sources=src
# Language
sonar.language=java
# Encoding of the source files
sonar.sourceEncoding=UTF-8
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助,
对我而言,原因是:https://stackoverflow.com/a/18779516/1068411
简而言之:你应该将声纳置于"后构建操作"中,而不是"后构建步骤".