简体   繁体   中英

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.

I am not very used to Scala and I overheard someone at the office saying it's not a standard project. Inside [ROOT_DIR] there is a folder app , that has only the launcher. Then I have domain and roles folders which contains modules, in [ROOT_DIR]/domain/[MODULE]/src and [ROOT_DIR]/roles/[MODULE]/src .

I have tried a few things with no data being passed to Sonarqube. One of the most promising leads is from this question: Multi module project analysis with 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.

So far my sonar-project.properties looks like:

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.

How can I get this running?

Managed to solve the issue with sbt sonarScan -Dsonar.java.binaries=target . With this, the sonar-project.properties is (apparently!) not needed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM