java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.String

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    sonarqube gradle plugin version ‘4.2.1.3168’
    Gradle version 8.2
    JVM: Zulu 17.0.9+8
    Operating System: Ubuntu 22.04.3
  • how is SonarQube deployed: zip, Docker, Helm
    SonarCloud: SonarCloud
  • what are you trying to achieve
    The gradle plugin is failing during executing the “sonarqube” task. I would like to understand what is the problem and find a fix for it.
  • what have you tried so far to achieve this
    Google search

Logs:
https://ge.apache.org/s/rrazkngaodxdy/failure#1

Hey there

Can you give a try with the latest version, 4.4.1.3373? Just making sure the latest version is affected before flagging it to the right team.

Hi Colin,

I have just tested it with the latest locally and unfortunately got the same outcome :frowning:

Thanks,
Adam

Thanks. Where is your code hosted? It would be great to see the build.gradle files, etc.

develop branch

Our github actions executing the below command:
./gradlew --no-daemon --console=plain -Dsonar.verbose=true -Dsonar.login=$SONAR_TOKEN -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.organization=$SONAR_ORGANIZATION -Dsonar.projectKey=$SONAR_PROJECT_KEY --info --stacktrace sonarqube

Maybe it helps.

Hello @Adam_Saghy,

Most likely this is happening because you’re using Groovy for you build scripts and it doesn’t enforce to follow the types contract. Probably, somewhere in the scripts you, where you setup jvm args, you use numbers, instead of string.

Our plugin is written in Java and is relying on the API, so we expect all compiler args to be Strings, but Groovy allows anything. Could you, please double-check if this issue is reproduced when you make all jvmArgs Strings?

We’re aware of the issue, but still not sure if it should be fixed on our side.

Best,
Margarita

Thank you Margarita_Nedzelska!

We will check it and let you know!

Regards,
Adam

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