sonar plugin does not work with java 10. inputs please.

2,629 views
Skip to first unread message

Sridhar Jonnalagadda

unread,
Apr 12, 2018, 7:22:40 PM4/12/18
to SonarQube
maven version:   Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T14:49:05-05:00)


maven profile: Though I tired to see, if new version of sonar-java-plugin will solve, it still refers to 4.x version.

<profiles>
    <profile>
        <id>sonar</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>sonar-maven-plugin</artifactId>
                    <version>3.4.0.905</version>
                    <dependencies>
                        <dependency>
                            <groupId>org.ow2.asm</groupId>
                            <artifactId>asm</artifactId>
                            <version>6.1.1<</version>
                        </dependency>
                        <dependency>
                            <groupId>org.sonarsource.java</groupId>
                            <artifactId>sonar-java-plugin</artifactId>
                            <version>5.2.0.13398</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>


Command:  mvn -X -P sonar  sonar:sonar

Waring about java version: [WARNING] 19:18:44.842 Invalid java version (got "1.10"). The version will be ignored. Accepted formats are "1.X", or simply "X" (for instance: "1.5" or "5", "1.6" or "6", "1.7" or "7", etc.)

Error:

[ERROR] 19:18:44.862 Unable to create symbol table for : <source file path from my project>
java.lang.IllegalArgumentException: null
at org.objectweb.asm.ClassReader.<init>(ClassReader.java:185) ~[sonar-java-plugin-4.15.0.12310.jar:na]
at org.objectweb.asm.ClassReader.<init>(ClassReader.java:168) ~[sonar-java-plugin-4.15.0.12310.jar:na]
at org.sonar.java.resolve.BytecodeCompleter.loadClass(BytecodeCompleter.java:228) ~[sonar-java-plugin-4.15.0.12310.jar:na]
at org.sonar.java.resolve.Symbols.<init>(Symbols.java:176) ~[sonar-java-plugin-4.15.0.12310.jar:na]
at org.sonar.java.resolve.SemanticModel.createFor(SemanticModel.java:58) ~[sonar-java-plugin-4.15.0.12310.jar:na]
at org.sonar.java.model.VisitorsBridge.visitFile(VisitorsBridge.java:101) ~[sonar-java-plugin-4.15.0.12310.jar:na]
at org.sonar.java.ast.JavaAstScanner.simpleScan(JavaAstScanner.java:96) [sonar-java-plugin-4.15.0.12310.jar:na]
at org.sonar.java.ast.JavaAstScanner.scan(JavaAstScanner.java:68) [sonar-java-plugin-4.15.0.12310.jar:na]
at org.sonar.java.JavaSquid.scanSources(JavaSquid.java:119) [sonar-java-plugin-4.15.0.12310.jar:na]
at org.sonar.java.JavaSquid.scan(JavaSquid.java:113) [sonar-java-plugin-4.15.0.12310.jar:na]
at org.sonar.plugins.java.JavaSquidSensor.execute(JavaSquidSensor.java:84) [sonar-java-plugin-4.15.0.12310.jar:na]
at org.sonar.batch.sensor.SensorWrapper.analyse(SensorWrapper.java:57) [sonar-scanner-engine-shaded-5.6.6.jar:na]
at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58) [sonar-scanner-engine-shaded-5.6.6.jar:na]
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50) [sonar-scanner-engine-shaded-5.6.6.jar:na]
at org.sonar.batch.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:83) [sonar-scanner-engine-shaded-5.6.6.jar:na]
at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:192) [sonar-scanner-engine-shaded-5.6.6.jar:na]
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142) [sonar-scanner-engine-shaded-5.6.6.jar:na]
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127) [sonar-scanner-engine-shaded-5.6.6.jar:na]
at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:241) [sonar-scanner-engine-shaded-5.6.6.jar:na]
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:236) [sonar-scanner-engine-shaded-5.6.6.jar:na]
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:234) [sonar-scanner-engine-shaded-5.6.6.jar:na]
at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:226) [sonar-scanner-engine-shaded-5.6.6.jar:na]
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142) [sonar-scanner-engine-shaded-5.6.6.jar:na]
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127) [sonar-scanner-engine-shaded-5.6.6.jar:na]
at org.sonar.batch.task.ScanTask.execute(ScanTask.java:47) [sonar-scanner-engine-shaded-5.6.6.jar:na]
at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86) [sonar-scanner-engine-shaded-5.6.6.jar:na]
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142) [sonar-scanner-engine-shaded-5.6.6.jar:na]
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127) [sonar-scanner-engine-shaded-5.6.6.jar:na]
at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:106) [sonar-scanner-engine-shaded-5.6.6.jar:na]
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119) [sonar-scanner-engine-shaded-5.6.6.jar:na]
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:79) [sonar-scanner-engine-shaded-5.6.6.jar:na]
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46) [sonar-scanner-api-batch10895730768231184217.jar:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:564) ~[na:na]
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60) [sonar-scanner-api-2.10.0.1189.jar:na]
at com.sun.proxy.$Proxy23.execute(Unknown Source) [na:na]
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:171) [sonar-scanner-api-2.10.0.1189.jar:na]
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:128) [sonar-scanner-api-2.10.0.1189.jar:na]
at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute(ScannerBootstrapper.java:63) [sonar-maven-plugin-3.4.0.905.jar:na]
at org.sonarsource.scanner.maven.SonarQubeMojo.execute(SonarQubeMojo.java:108) [sonar-maven-plugin-3.4.0.905.jar:na]
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137) [maven-core-3.5.3.jar:3.5.3]
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) [maven-core-3.5.3.jar:3.5.3]
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154) [maven-core-3.5.3.jar:3.5.3]
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146) [maven-core-3.5.3.jar:3.5.3]
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117) [maven-core-3.5.3.jar:3.5.3]
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81) [maven-core-3.5.3.jar:3.5.3]
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56) [maven-core-3.5.3.jar:3.5.3]
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) [maven-core-3.5.3.jar:3.5.3]
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305) [maven-core-3.5.3.jar:3.5.3]
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192) [maven-core-3.5.3.jar:3.5.3]
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105) [maven-core-3.5.3.jar:3.5.3]
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956) [maven-embedder-3.5.3.jar:3.5.3]
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290) [maven-embedder-3.5.3.jar:3.5.3]
at org.apache.maven.cli.MavenCli.main(MavenCli.java:194) [maven-embedder-3.5.3.jar:3.5.3]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:564) ~[na:na]
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) [plexus-classworlds-2.5.2.jar:na]
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) [plexus-classworlds-2.5.2.jar:na]
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) [plexus-classworlds-2.5.2.jar:na]
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) [plexus-classworlds-2.5.2.jar:na]

Michael Gumowski

unread,
Apr 13, 2018, 3:06:25 AM4/13/18
to Sridhar Jonnalagadda, SonarQube
Hello,

Latest release of SonarJava (5.2) is not yet compatible with Java 10.
However, version 5.3 is about to be released (in a few hours). It includes support of Java10. This issue should then disappear.

In order to make the analysis pass, you will need to update your version of SonarJava to 5.3.

Cheers,
Michael

--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/6b9f0da3-b2a1-4667-9377-05ba843f4b02%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Michael Gumowski | SonarSource
Software Developer, Language Team
https://www.sonarsource.com

Sridhar Jonnalagadda

unread,
Apr 13, 2018, 9:45:58 AM4/13/18
to SonarQube
Michael,

Your input is appreciated.

I have other question about maven sonar plugin. Looks it does not override, even if I point it to latest deps. From stack trace it still points to 4.x version. Is there a property I need to specify, to override sonar-java-plugin version?

Snippet from stack trace:

at org.objectweb.asm.ClassReader.<init>(ClassReader.java:185) ~[sonar-java-plugin-4.15.0.12310.jar:na]

Maven config:

Michael Gumowski

unread,
Apr 13, 2018, 9:55:07 AM4/13/18
to Sridhar Jonnalagadda, SonarQube
Hello,

The Sonar maven plugin is going to use the SonarJava plugin version provided by your SonarQube instance. It means that in order to use the latest version of the the SonarJava plugin, you need to update it in the SonarQube instance your project is connected to (Admin panel > marketplace > SonarJava).

Note that SonarJava 5.2 (and 5.3 soon) requires SonarQube 6.7 LTS. Earlier versions of SonarQube (5.x) are not supported anymore.

Hope this helps,
Michael


For more options, visit https://groups.google.com/d/optout.

Sridhar Jonnalagadda

unread,
Apr 13, 2018, 11:22:50 AM4/13/18
to SonarQube
Thank you Michael.

martij...@gmail.com

unread,
Apr 17, 2018, 3:18:32 AM4/17/18
to SonarQube
Hi Michael,

I just updated to sonar-java 5.3, however analysis of Java 10 still doesn't appear to work. I think the difference here is that the sonar-scanner itself is also running on a Java 10 vm. We use the Maven scanner, so it's quite straightforward to run the analysis on the same JDK that the rest of the build runs. Perhaps you could shine a light on whether that's supposed to be supported?
I have some build output below, just in case.

Regards,
Martijn

[INFO] --- sonar-maven-plugin:3.4.0.905:sonar (default-cli) @ xxx ---
[INFO] User cache: /root/.sonar/cache
[INFO] SonarQube version: 7.0.0
[INFO] Default locale: "en", source code encoding: "UTF-8"
[INFO] Publish mode
[INFO] Load global settings
[INFO] Load global settings (done) | time=206ms
[INFO] Server id: xxx
[INFO] User cache: /root/.sonar/cache
[INFO] Load plugins index
[INFO] Load plugins index (done) | time=93ms
[INFO] Load/download plugins
[INFO] Load/download plugins (done) | time=1752ms
[INFO] Process project properties
[INFO] Load project repositories
[INFO] Load project repositories (done) | time=617ms
[INFO] Execute project builders
[INFO] Execute project builders (done) | time=1ms
[INFO] Load quality profiles
[INFO] Load quality profiles (done) | time=155ms
[INFO] Load active rules
[INFO] Load active rules (done) | time=1536ms
[INFO] Load metrics repository
[INFO] Load metrics repository (done) | time=94ms
[INFO] Project key: xxx:xxx
[INFO] Branch key: develop
[INFO] -------------  Scan XXX
[INFO] Base dir: /builds/xxx
[INFO] Working dir: /builds/xxx
[INFO] Source paths: pom.xml, src/main/java
[INFO] Test paths: src/test/java
[INFO] Source encoding: UTF-8, default locale: en
[INFO] Load server rules
[INFO] Load server rules (done) | time=168ms
[INFO] Index files
[INFO] 41 files indexed
[INFO] Quality profile for java: XXX
[INFO] Sensor JavaSquidSensor [java]
[INFO] Configured Java source version (sonar.java.source): 5
[INFO] JavaClasspath initialization
[INFO] JavaClasspath initialization (done) | time=23ms
[INFO] JavaTestClasspath initialization
[INFO] JavaTestClasspath initialization (done) | time=3ms
[INFO] Java Main Files AST scan
[INFO] 31 source files to be analyzed
[WARNING] Classes not found during the analysis : [java.sql.Connection, java.sql.SQLException]
[INFO] Java Main Files AST scan (done) | time=4317ms
[INFO] Java Test Files AST scan
[INFO] 9 source files to be analyzed
[INFO] 31/31 source files have been analyzed
[INFO] 9/9 source files have been analyzed
[INFO] Java Test Files AST scan (done) | time=403ms
[INFO] Sensor JavaSquidSensor [java] (done) | time=5845ms
[INFO] Sensor FindBugs Sensor [findbugs]
[INFO] Loading findbugs plugin: /builds/xxx/target/sonar/findbugs/fb-contrib.jar
[INFO] Loading findbugs plugin: /builds/xxx/target/sonar/findbugs/findsecbugs-plugin.jar
[INFO] Findbugs output report: /builds/xxx/target/sonar/findbugs-result.xml
The following errors occurred during analysis:
  Error scanning xxx.Foo for referenced classes
    java.lang.IllegalArgumentException
      At org.objectweb.asm.ClassReader.<init>(ClassReader.java:160)
      At org.objectweb.asm.ClassReader.<init>(ClassReader.java:143)
      At edu.umd.cs.findbugs.asm.FBClassReader.<init>(FBClassReader.java:35)
      At edu.umd.cs.findbugs.classfile.engine.asm.ClassReaderAnalysisEngine.analyze(ClassReaderAnalysisEngine.java:48)
      At edu.umd.cs.findbugs.classfile.engine.asm.ClassReaderAnalysisEngine.analyze(ClassReaderAnalysisEngine.java:34)
      At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:262)
      At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:75)
      At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:38)
      At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:262)
      At edu.umd.cs.findbugs.FindBugs2.buildReferencedClassSet(FindBugs2.java:773)
      At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:219)
      At org.sonar.plugins.findbugs.FindbugsExecutor$FindbugsTask.call(FindbugsExecutor.java:235)
      At java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      At java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
      At java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
      At java.base/java.lang.Thread.run(Thread.java:844)
  Unable to get XClass for java/lang/Integer
    java.lang.IllegalArgumentException
      At org.objectweb.asm.ClassReader.<init>(ClassReader.java:160)
      At org.objectweb.asm.ClassReader.<init>(ClassReader.java:143)
      At edu.umd.cs.findbugs.asm.FBClassReader.<init>(FBClassReader.java:35)
      At edu.umd.cs.findbugs.classfile.engine.asm.ClassReaderAnalysisEngine.analyze(ClassReaderAnalysisEngine.java:48)
      At edu.umd.cs.findbugs.classfile.engine.asm.ClassReaderAnalysisEngine.analyze(ClassReaderAnalysisEngine.java:34)
      At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:262)
      At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:75)
      At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:38)
      At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:262)
      At edu.umd.cs.findbugs.ba.XFactory.getXClass(XFactory.java:687)
      At edu.umd.cs.findbugs.ba.AnalysisContext.setAppClassList(AnalysisContext.java:970)
      At edu.umd.cs.findbugs.FindBugs2.setAppClassList(FindBugs2.java:876)
      At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:222)
      At org.sonar.plugins.findbugs.FindbugsExecutor$FindbugsTask.call(FindbugsExecutor.java:235)
      At java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      At java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
      At java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
      At java.base/java.lang.Thread.run(Thread.java:844)

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:26 min
[INFO] Finished at: 2018-04-17T06:18:48Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905:sonar (default-cli) on project xxx: Can not execute Findbugs: java.lang.RuntimeException: edu.umd.cs.findbugs.NoClassesFoundToAnalyzeException: No classes found to analyze in /builds/xxx/target/classes/xxx/Foo.class

Michael Gumowski

unread,
Apr 17, 2018, 3:29:25 AM4/17/18
to martij...@gmail.com, SonarQube
Hello,

From what I can see in your logs, it seems that the findbugs plugin is not able to read Java 10 bytecode. Consequently, it is making your analysis fail. Except from disabling the findbugs plugin until they fix the issue, I can't see other way to make the analysis pass. 

You may want to contact maintainers of the plugin directly to report  the issue: https://github.com/spotbugs/sonar-findbugs 

Hop this helps.
Michael

Note that it's not a problem of having the scanner run on Java 10. This seems to work.


For more options, visit https://groups.google.com/d/optout.

Martijn Baay

unread,
Apr 17, 2018, 3:32:18 AM4/17/18
to Michael Gumowski, SonarQube
Thanks for the info! I'll create a bug report there.

Regards,
Martijn

Dominik Kaspar

unread,
May 17, 2018, 2:20:32 AM5/17/18
to SonarQube
Hi Michael,

We have exactly the same problem with our SonarQube 6.7.2 and one of our projects that now uses Java 10.
There are tons of "Unable to get XClass for SomeClass" and "Couldn't get class info for SomeClass" errors during the analysis...

Although the real problem is at the Findbugs side, I don't understand why the analysis fails if the default Java profile contains zero FindBugs rules.
When setting the default profile to "Sonar way", no Findbugs rule should be executed, and no such Java 10 related errors should occur.

We do have the Findbugs plugin installed and many other projects are using it, so we cannot just uninstall it.
How is it possible for a project that does not care at all about Findbugs to ignore Findbugs during the analysis?

Regards,
Dominik

Michael Gumowski

unread,
May 17, 2018, 3:21:26 AM5/17/18
to Dominik Kaspar, SonarQube
Hello Dominik,

Unfortunately, I have no idea how to explicitly exclude a plugin to be executed during build.
I guess FindBugs sensor is triggered because of existence of java files, and deactivating rules would be not enough. But I don't know how this plugin is working. Did you try contacting directly the Findbugs plugin maintainers? (https://github.com/spotbugs/sonar-findbugs )

Cheers,
Michael


For more options, visit https://groups.google.com/d/optout.

Dominik Kaspar

unread,
May 17, 2018, 5:10:05 AM5/17/18
to SonarQube
Hi,

Thanks for the quick reply. I did not contact the Findbugs maintainers, but I realized that they already fixed the problem, just didn't release it yet.
So now I've built the latest snapshot and manually installed it and the errors indeed disappeared...

Cheers,
Dominik
Reply all
Reply to author
Forward
0 new messages