I just downloaded the latest version, SonarQube 4.3, then try build a java-8 project with:
mvn clean install
mvn sonar:sonar
That gives me the Exception below.
Googling, I got the impression this is an earlier issue that should have been fixed... ?
http://sonarqube.15.x6.nabble.com/Sonar-analyze-Java-1-8-project-Failure-td5023663.html
http://jira.codehaus.org/browse/SONARJAVA-482
Does SonarQube 4.3 support java-8?
Or any clue, what is the problem?
-------------------------------------------------------
T E S T S
-------------------------------------------------------
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
Caused by: java.lang.RuntimeException: Class java/util/UUID could not be instrumented.
at org.jacoco.agent.rt.internal_6effb9e.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:138)
at org.jacoco.agent.rt.internal_6effb9e.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:99)
at org.jacoco.agent.rt.internal_6effb9e.PreMain.createRuntime(PreMain.java:55)
at org.jacoco.agent.rt.internal_6effb9e.PreMain.premain(PreMain.java:47)
... 6 more
Caused by: java.lang.NoSuchFieldException: $jacocoAccess
at java.lang.Class.getField(Class.java:1690)
at org.jacoco.agent.rt.internal_6effb9e.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:136)
... 9 more
FATAL ERROR in native method: processing of -javaagent failed
Exception in thread "main"
I got the missing info from the SonarQube mailing-list... To summarize:
To get Java8 maven-build working on SonarQube-4.3:
Install sonarqube-4.3, and start the server.
Login to the web-gui => Settings => Update Center => Plugins Updates => Java => Click "Upgrade to 2.2.1"
Wait a minute or so for the upgrade to complete... then shutdown+restart sonarqube. Go back into the Upgrade Center and verify you have plugin: Java 2.2.1
To get code-coverage in Sonar, you now need to build with these commands:
mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install
mvn sonar:sonar
Reference: http://docs.codehaus.org/display/SONAR/JaCoCo+Plugin
That's it.
Here with java 11 I had this problem and I fix adding this in my gradle properties:
jacoco {
toolVersion = "0.8.4"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With