[英]How to trigger sonarqube analysis for multi-module Scala project?
I need to analyse a multi-module Scala legacy project in Sonarqube v7.6 that has the Scala plugin already installed.我需要在已经安装了 Scala 插件的 Sonarqube v7.6 中分析一个多模块 Scala 遗留项目。
I am not very used to Scala and I overheard someone at the office saying it's not a standard project.我不太习惯 Scala,我无意中听到办公室有人说它不是一个标准项目。 Inside [ROOT_DIR] there is a folder
app
, that has only the launcher.在 [ROOT_DIR] 中有一个文件夹
app
,它只有启动器。 Then I have domain
and roles
folders which contains modules, in [ROOT_DIR]/domain/[MODULE]/src
and [ROOT_DIR]/roles/[MODULE]/src
.然后我在
[ROOT_DIR]/domain/[MODULE]/src
和[ROOT_DIR]/roles/[MODULE]/src
有包含模块的domain
和roles
文件夹。
I have tried a few things with no data being passed to Sonarqube.我尝试了一些事情,但没有将数据传递给 Sonarqube。 One of the most promising leads is from this question: Multi module project analysis with SonarQube .
最有希望的线索之一来自这个问题: 使用 SonarQube 进行多模块项目分析。
I don't mind having a sonar-project.properties
file I can just run sbt sonarScan
off the [ROOT_DIR] and check the analysis in sonarqube.我不介意有一个
sonar-project.properties
文件,我可以在 [ROOT_DIR] 上运行sbt sonarScan
并检查 sonarqube 中的分析。
So far my sonar-project.properties
looks like:到目前为止,我的
sonar-project.properties
看起来像:
sonar.projectKey=myProject
sonar.sources=src/main/scala
sonar.login=e0fc3c8acf7028ebaca34bd5ddfb740d5498ee39
sonar.tests=src/test/scala
sonar.sourceEncoding=UTF-8
sonar.scala.version=2.12
sonar.modules=moduleA, moduleB, moduleC
moduleA.sonar.projectName=moduleA
moduleA.sonar.sources=domain/moduleA/src
moduleB.sonar.projectName=moduleB
moduleB.sources=domain/moduleB/src
moduleC.sonar.projectName=moduleC
moduleC.sonar.sources=domain/moduleC/src
While this looks good, I am getting the following error:虽然这看起来不错,但我收到以下错误:
[error] (moduleA / sonarScan) Not authorized. Please check the properties sonar.login and sonar.password.
The login and password error is a bit weird because Sonarqube is behind OneLogin so I don't have any issues scanning the other projects that use Maven and Java/Kotlin.登录名和密码错误有点奇怪,因为 Sonarqube 在 OneLogin 后面,所以我在扫描其他使用 Maven 和 Java/Kotlin 的项目时没有任何问题。
How can I get this running?我怎样才能让它运行?
Managed to solve the issue with sbt sonarScan -Dsonar.java.binaries=target
.设法解决了
sbt sonarScan -Dsonar.java.binaries=target
。 With this, the sonar-project.properties
is (apparently!) not needed.有了这个,
sonar-project.properties
是(显然!)不需要的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.