Sonarqube gradle task failing with java 10

gradle
java
sonarqube

(Ludo) #1

Hi,
Ive got a working project with java8 and publishing data to sonarqube. When i move the java version used to 10, it is not working anymore. That is the only change I do.

I’ve created a sample project to reproduce the issue, it is available there: https://github.com/ltoublanc/spring-boot-sonarqube

On that project, if you execute it with 2 different jre (such as 9 and 10), you will have different results.

Versions used

  • sonar gradle plugin: 2.6.2
  • sonarqube docker image: 7.1
  • java 9: Java™ SE Runtime Environment (build 9+181)
  • java 10: Java™ SE Runtime Environment 18.3 (build 10.0.1+10)

Error observed

Basically, with java10, the build is failing with stack like that for all classes:

Unable to create symbol table for : /Users/user/devtools/code/sonarqube-sample/src/test/java/com/example/sonarqubesample/SonarqubeSampleApplicationTests.java
java.lang.IllegalArgumentException: null
at org.objectweb.asm.ClassReader.(ClassReader.java:160)
at org.objectweb.asm.ClassReader.(ClassReader.java:143)

The steps to reproduce are described in the readme of the sample repository.

I haven’t found any workaround.


Java analysis using Java 10, and overall java support
(G Ann Campbell) #2

Hi,

Your analysis is failing with Java 10 because we don’t support Java 10.

Ann


(Ludo) #3

Hi Ann,
Thank you for the quick reply, that’s sound a fair answer :slight_smile:

So what do you recommend if I want to have a java 9+ project, as java9 is not supported anymore? Should I still go for java9 at the moment, and move to a java 10 jdk when that will be supported by sonarqube?

I don’t really want to start with java 8…

Ludo


(G Ann Campbell) #4

Hi Ludo,

You can compile and analyze with different versions.

:slight_smile:
Ann


(Ludo) #5

Hi Ann,

to be sure I get what you’re suggesting:

I can compile using like a jdk10:
gradle build

and then using a jdk9 to run:
gradle sonarqube

Is that the workaround you sugested, or is that about properties/configuration or anything else that I miss?

Ludo


(G Ann Campbell) #6

Yes, that’s what I’m suggesting.


(Ludo) #7

thank you Ann for your feedback


(G Ann Campbell) #11

Hi,

Just to be clear, even though you apparently can run analysis with Java 9, you probably should use Java 8, which is what we officially support.

Ann


(Tibor Blenessy) #13

Hello @ludo,

the reason why your analysis is failing is because you are using older version of SonarQube. You can either upgrade your SonarQube to 7.2 , or you can upgrade SonarJava plugin in your SQ instance.

You should be able to run analysis using Java 10 in general. If you encounter any issues, let us know here and we will try to fix it.


Error sending analysis to SonarQube with JDK 10