为多个 java 项目设置 sonar-runner
我正在尝试运行 sonar-runner 以一次性分析多个 Java 项目.根据 documentation,这只是创建一个 <每个项目的 code>sonar-project.properties 文件.但我不清楚我必须将这些 sonar-project.properties 文件放在哪里.
我尝试在 $SONAR_RUNNER_HOME/conf
文件夹中添加多个 .properties 文件,但跑步者似乎没有选择它们.它只看到 sonar-project.properties 文件.
关于如何为多个项目运行 sonar-runner 有什么建议吗?
解决方案其实让sonar runner分析多个项目,只要它们在同一个文件系统中,还是很简单的.只需将属性文件放在离项目不远的目录中即可.然后在此属性文件中声明您的每个项目.
假设您在 dev/general/BasicStuff、dev/service/CoolStuff、dev/utility/UtilStuff 和 dev/display/FrameWorkStuff 中有 4 个项目.
如 此处中所述,您可以通过方式 #2 创建一个dev 中包含该行的文件
sonar.modules=BasicStuff,CoolStuff,UtilStuff,FrameWorkStuff
对于每个模块",一行
BasicStuff.sonar.projectBaseDir=general/BasicStuffCoolStuff.sonar.projectBaseDir=服务/CoolStuff
在项目目录中,您依次创建一个包含其他所需信息的文件,例如
sonar.projectName=BasicStuffsonar.sources=src
如果您以顶级属性作为目标启动 sonar runner,您将获得一个全面的结果,其中显示了项目中的指标,并允许您深入了解每个项目.
希望这就是你要找的.p>
I am trying to run sonar-runner to analyze multiple Java projects in one go. According to the documentation it is just a matter of creating a sonar-project.properties
file for each project. But it is not clear to me where exactly I have to put these sonar-project.properties files.
I tried to add multiple .properties files in the $SONAR_RUNNER_HOME/conf
folder but the runner does not seem to pick them up. It only sees the sonar-project.properties file.
Any suggestions on how to run sonar-runner for multiple projects?
解决方案Actually it is quite simple to let the sonar runner analyze multiple projects as long as they are in the same file system. Just put a properties file in a directory that is not to far away from the projects. Then declare each of your projects in this properties file.
Lets assume you have 4 projects in dev/general/BasicStuff, dev/service/CoolStuff, dev/utility/UtilStuff and dev/display/FrameWorkStuff.
As described in hereWay #2 you create a file in dev which contains the line
sonar.modules=BasicStuff,CoolStuff,UtilStuff,FrameWorkStuff
And for each of the "modules" a line like
BasicStuff.sonar.projectBaseDir=general/BasicStuff
CoolStuff.sonar.projectBaseDir=service/CoolStuff
Inside the project directories you in turn create a file which contains the other needed information, e.g.
sonar.projectName=BasicStuff
sonar.sources=src
If you start sonar runner with the top level properties as target you get a comprehensive result which shows metrics across the projects as well as allowing you to drill into each of them.
Hope this was what you were looking for.
相关文章