相关疑难解决方法(0)

声纳:您必须为未解决的未知定义以下强制属性

我正在尝试在java中的项目上运行SonarQube.我配置了声纳属性文件并将其放在项目目录中.在运行sonar.bat时,会出现一个错误,要求定义必需参数.起初我认为我的属性文件是错误的,但我已经尝试了我能想到的一切.

这是当前的属性文件

# Required metadata
sonar.projectKey=_newtest2
sonar.projectName=NoSqlDataModeling
sonar.projectVersion=2.0

# Path to the parent source code directory.
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# Since SonarQube 4.2, this property is optional if sonar.modules is set. 
# If not set, SonarQube starts looking for source code from the directory containing 
# the sonar-project.properties file.
sonar.sources=D:/eclipse workspace/NoSqlDataModeling


#Comma-separated paths to directories containing the binary files (directories with class files, in the case of Java).
sonar.binaries=D:/eclipse …
Run Code Online (Sandbox Code Playgroud)

java sonar-runner sonarqube

11
推荐指数
2
解决办法
4万
查看次数

SonarRunner找不到sonar.projectKey,sonar.projectName,sonar.projectVersion,sonar.sources

我试图让Jenkins在构建后的步骤中运行Sonar.

Jenkins运行SonarRunner [1],但这失败了:

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
Run Code Online (Sandbox Code Playgroud)

如果我运行mvn sonar:sonar[2]而不是它工作正常.听起来好像SonarRunner忽略了pom.xml.如何让SonarRunner从Maven获取这些属性?


[1] /Users/builds/.jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/Default_Sonar_Runner/bin/sonar-runner -Dsonar.jdbc.url=jdbc:h2:tcp://myServer:1009/sonar -Dsonar.host.url=http://myServer/sonar/ -Dsonar.projectBaseDir=/Users/builds/.jenkins/workspace/myProject

[2] mvn sonar:sonar -Dsonar.jdbc.url=jdbc:h2:tcp://myServer:1009/sonar -Dsonar.host.url=http://myServer/sonar/ -Dsonar.projectBaseDir=/Users/builds/.jenkins/workspace/myProject

maven jenkins sonarqube

9
推荐指数
1
解决办法
2万
查看次数

标签 统计

sonarqube ×2

java ×1

jenkins ×1

maven ×1

sonar-runner ×1