When I gradle sonarqube
on a kotlin-dsl multimodule kotlin project , all the sub-modules that should be analyzed are detected:
$ ./gradlew sonarqube --dry-run | grep sonarqube
:logging-api:sonarqube SKIPPED
:logging-core:sonarqube SKIPPED
:logging-examples:sonarqube SKIPPED
:logging-recipe-proxylogger:sonarqube SKIPPED
:logging-sink-inmemory:sonarqube SKIPPED
:logging-sink-printstream:sonarqube SKIPPED
So far, so good. But when I actually run it, and then look in Sonarcloud, I get 6 background tasks for the exact same project name. I don’t want to have to touch every module to add extra sonarQube properties when everything is already part of the gradle object model.
Because there is no actual example of a kotlin-dsl multimodule kotlin project in your github repo, I had to look somewhere else, and even trying to add
sonarqube {
properties {
property("sonar.projectName", "xxxxx-logging:${project.name}")
}
}
Leads to the same outcome. In fact it’s even worse, because the name under which all background tasks are created looks non-deterministic (in my example it’s now proxylogger).
I use org.gradle.parallel=true
as a matter of course. So maybe that is not supported.
If I deactivate parallelism, I still get confusing output. The gradlew sonarqube
command tells me the quality gate is FAILED, but the background task says SUCCESS.
Can someone on your end actually go through the motion of creating a working kotlin-dsl multimodule kotlin project scanning example, and share it for our benefit?
This takes 5 minute to generate such a project with gradle init:
$ gradle init
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
Select type of project to generate:
1: basic
2: application
3: library
4: Gradle plugin
Enter selection (default: basic) [1..4] 2
Select implementation language:
1: C++
2: Groovy
3: Java
4: Kotlin
5: Scala
6: Swift
Enter selection (default: Java) [1..6] 4
Split functionality across multiple subprojects?:
1: no - only one application project
2: yes - application and library projects
Enter selection (default: no - only one application project) [1..2] 2
Select build script DSL:
1: Groovy
2: Kotlin
Enter selection (default: Kotlin) [1..2] 2
Project name (default: example): multimodule-kotlin-dsl-kotlin-project
Source package (default: multimodule.kotlin.dsl.kotlin.project):
> Task :init
Get more help with your project: https://docs.gradle.org/6.8.3/samples/sample_building_kotlin_applications_multi_project.html
BUILD SUCCESSFUL in 51s
2 actionable tasks: 2 executed
Cheers