SonarCloud scanner fails with java.lang.UnsupportedOperationException in Azure DevOps build

Hi, i am trying to include SonarCloud scanner into our Azure DevOps build pipelines, but keep getting this UnsupportedOperationException. It is a gradle multi project build.
Some version informations:
Gradle 7.5.1
Kotlin: 1.6.21
Groovy: 3.0.10
JVM: 17.0.5 (Eclipse Adoptium 17.0.5+8)
OS: Linux 5.15.0-1051-azure amd64
sonarQubePluginVersion: 4.4.1.3373

I was following documentation and added a prepare analysis task like this:
image

In the root build gradle of our multi project i added this in the plugins section:

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

and in the subprojects section i also applied the plugin

subprojects {
    apply(plugin = "org.sonarqube")
    sonar {
        properties {
            //property "sonar.java.libraries",
        }
    }
}

Error thrown:

> Task :sonarqube
Task 'sonarqube' is deprecated. Use 'sonar' instead.
Could not report issue with code highlighting, using plain text instead. Check whether the product is outdated.
java.lang.UnsupportedOperationException: null
	at org.sonar.api.batch.sensor.issue.internal.DefaultIssueLocation.newMessageFormatting(DefaultIssueLocation.java:97)
	at org.sonarsource.kotlin.api.checks.InputFileContextImpl.message(InputFileContextImpl.kt:93)
	at org.sonarsource.kotlin.api.checks.InputFileContextImpl.reportIssue(InputFileContextImpl.kt:68)
	at org.sonarsource.kotlin.api.checks.AbstractCheck.reportIssue(AbstractCheck.kt:69)
	at org.sonarsource.kotlin.api.checks.AbstractCheck.reportIssue(AbstractCheck.kt:88)
	at org.sonarsource.kotlin.api.checks.AbstractCheck.reportIssue$default(AbstractCheck.kt:83)
	at org.sonarsource.kotlin.gradle.checks.CorePluginsShortcutUsageCheck.visitCallExpression(CorePluginsShortcutUsageCheck.kt:48)
	at org.sonarsource.kotlin.gradle.checks.CorePluginsShortcutUsageCheck.visitCallExpression(CorePluginsShortcutUsageCheck.kt:34) ...

Hi Philip,

Welcome to the community!

Thanks for the report, this is a known issue. The good news is that it doesn’t actually fail anything and there is nothing to do on your side. The analysis will still succeed (provided there are no other issues of course).

This message should not be logged as it is - we will improve that.

1 Like