Setup sonar-runner for multiple java projects(为多个 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.
这篇关于为多个 java 项目设置 sonar-runner的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:为多个 java 项目设置 sonar-runner
- Jersey REST 客户端:发布多部分数据 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01