Analyze Java 13 via Gradle

Hello,
I recently moved to Java 13 in my project and the sonarqube gradle plugin v2.8 began throwing exception about invalid class loader version 57. Seems like Java 13 isn’t supported?
Any info about when the plugin will be updated with Java 13 support?
Thanks.

Hi Gennady,

Java 13 should be supported and I’m able to analyze a java project using java 13 (AdoptOpenJDK 13.0.2), gradle 6.3, sonarqube gradle plugin 2.8 and SonarQube 8.2. But I notice that using an old version of gradle (5.2.1) I was facing errors java.lang.IllegalArgumentException: Unsupported class file major version 57 during the build, even without any sonarqube plugin. Are you able to build without sonarqube plugin? Which gradle version are you using? Could you share your error stack trace?

Hi Alban,
Thank you for your mail.
I think my problem was an old SonarQube version 6.7.5.
After I ran sonar task against SonarQube 8.2 docker I see analyzes, even though I still have to adjust some coverage parameters in the gradle file, but at least I could see errors again.
Could you please provide me with an example of the right Jacoco parameters I should define in the build.gradle file for the SonarQube v8.2?
Thanks
Gennady

Hi Gennady,

About importing the JaCoCo report, the last SonarQube version that support JaCoCo report binary format (*.exec files) was SonarQube 8.1. Since SonarQube 8.2 only the XML format is supported.
To generated this format, you need to add in your build.gradle:

jacocoTestReport {
    reports {
        xml.enabled true
    }
}

And you can see how to invoke jacocoTestReport here: [Coverage & Test Data] Importing JaCoCo coverage report in XML format

1 Like

Hi again,
I have a question about SQ 7.9.3 LTS: do you know if it supports Java 13 code?

Thanks

Hi Gennady,

SQ 7.9.3 LTS includes by default the java analyzer 5.13.1. This java analyzer should be able to analyze java 13 source code (including the preview feature “switch expressions” but not the preview feature “text blocks”).
If you need to support “text blocks”, you should use at least SQ 8.2 that include the java analyzer 6.1.
Note: Java analyzers since 6.XX have improved significantly their understanding of semantic information related to latset versions of java.