本文介绍了SonarRunner找不到sonar.projectKey,sonar.projectName,sonar.projectVersion,sonar.sources的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试让詹金斯(Jenkins)运行Sonar作为构建后的步骤.

I am attempting to get Jenkins to run Sonar as a post-build step.

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

Jenkins runs SonarRunner [1] but this fails with:

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

如果我运行mvn sonar:sonar [2],则可以正常工作.听起来好像SonarRunner正在忽略pom.xml. 我如何让SonarRunner从Maven获得这些属性?

If I run mvn sonar:sonar [2] instead it works fine. It almost sounds like SonarRunner is ignoring pom.xml. How do I get SonarRunner to pick up these properties from 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

推荐答案

浪费一个晚上的好方法...

What a nice way to waste an evening...

根据,Sonar Runner不适用于Maven项目.事实证明,您应该在构建后操作"下查看(而不是构建后步骤"),然后会找到声纳".有关更多信息,请参见此处.

According to this Sonar Runner is not meant for Maven projects. It turns out you're supposed to look under "Post-Build Actions" (not "Post-Build Steps") and you will find "Sonar". See here for more information.

这篇关于SonarRunner找不到sonar.projectKey,sonar.projectName,sonar.projectVersion,sonar.sources的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-10 16:48