SonarCloud with multi module Android project (Java + Kotlin) using Kotlin KTS

We’re using Github as source control and Jenkins as CI system. Our Android project consists of Java (66%) and Kotlin (34%), it’s split into multiple modules (>10) and we’re using Kotlin KTS for syncing dependencies.

My question, how do you setup sonar cloud dependency for such project? I’m only seeing documentation for setting up in Groovy-based manner.

Welcome to the community!

Just to clarify, is your question about this kind of snippet in our tutorial for analyzing with Gradle?

plugins {
  id "org.sonarqube" version "3.2.0"
}

sonarqube {
  properties {
    property "sonar.projectKey", "your-project-key"
    property "sonar.organization", "your-organization-key"
    property "sonar.host.url", "https://sonarcloud.io"
  }
}

And your question is that it would be nice to have the Kotlin flavor of this instead of Groovy flavor?

Or do you mean something else?

Yep. How would you write that Groovy code in Kotlin DSL? When I try, it returns errors in syncing dependencies and it won’t build the multi-module project.

The equivalent in Kotlin DSL would be:

plugins {
  id("org.sonarqube") version "3.1.1"
}

sonarqube {
  properties {
    property("sonar.projectKey", "your-project-key")
    property("sonar.organization", "your-organization-key")
    property("sonar.host.url", "https://sonarcloud.io")
  }
}

Omg… sorry for wasting your time on this. Didn’t see the version and without it, it’s not able to sync the dependency.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.