Evaluating SonarLint with VS Code Java project. Everything builds and runs successfully at the command line with Gradle, and from within VS Code. Not seeing any SL suggestions in VS Code though; checking SL output window shows the error below; any ideas? Thanks!
Update: Tried the same project using the Eclipse plugin and everything worked as expected. So this seems to be an issue with the VS Code plugin specifically at this point?
Update #2: I restarted Eclipse and now I’m no longer getting any SonarLint issues reported, even after explicitly analyzing all project files using the context menu. I can’t find an equivalent to the VS Code “Show SonarLint output” feature though so I’m not sure if it’s the same issue.
[Error - 14:32:20.368] java.lang.IllegalStateException: No files nor directories matching '\idmp-local-client\bin\default'
at org.sonar.java.classpath.AbstractClasspath.getFilesFromProperty(AbstractClasspath.java:129)
at org.sonar.java.classpath.ClasspathForMain.init(ClasspathForMain.java:61)
at org.sonar.java.classpath.AbstractClasspath.getElements(AbstractClasspath.java:317)
at org.sonar.java.SonarComponents.getJavaClasspath(SonarComponents.java:164)
at org.sonar.java.JavaSquid.<init>(JavaSquid.java:86)
at org.sonar.plugins.java.JavaSquidSensor.execute(JavaSquidSensor.java:100)
at org.sonarsource.sonarlint.core.analyzer.sensor.SensorsExecutor.executeSensor(SensorsExecutor.java:80)
at org.sonarsource.sonarlint.core.analyzer.sensor.SensorsExecutor.execute(SensorsExecutor.java:71)
at org.sonarsource.sonarlint.core.container.analysis.AnalysisContainer.doAfterStart(AnalysisContainer.java:132)
at org.sonarsource.sonarlint.core.container.ComponentContainer.startComponents(ComponentContainer.java:126)
at org.sonarsource.sonarlint.core.container.ComponentContainer.execute(ComponentContainer.java:111)
at org.sonarsource.sonarlint.core.container.standalone.StandaloneGlobalContainer.analyze(StandaloneGlobalContainer.java:153)
at org.sonarsource.sonarlint.core.StandaloneSonarLintEngineImpl.analyze(StandaloneSonarLintEngineImpl.java:90)
at org.sonarsource.sonarlint.ls.AnalysisManager.lambda$analyzeStandalone$8(AnalysisManager.java:371)
at org.sonarsource.sonarlint.ls.AnalysisManager.analyzeWithTiming(AnalysisManager.java:422)
at org.sonarsource.sonarlint.ls.AnalysisManager.analyzeStandalone(AnalysisManager.java:371)
at org.sonarsource.sonarlint.ls.AnalysisManager.analyze(AnalysisManager.java:266)
at org.sonarsource.sonarlint.ls.AnalysisManager.lambda$analyzeAsync$0(AnalysisManager.java:224)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
On the VSCode side, could you please enable both sonarlint.output.showVerboseLogs and sonarlint.output.showAnalyzerLogs in your user settings, trigger a new analysis and post the contents of the “SonarLint” output?
On the Eclipse side, you’ll want to check the SonarLint Console - “Window” > “Show view” > “Console”, then select the SonarLint console:
If I understand correctly the exception that you posted, it looks like the Java language server feeds SonarLint with a classpath entry - \idmp-local-client\bin\default - that cannot be found by SonarLint’s Java analyzer; I would be curious to see how this happens, e.g if you are using UNC paths that are somehow not handled properly.
After a bit of investigation, it seems that the classpath resolution somehow returns a path that does not exist on the local file system, in this case \idmp-core\bin\default.
I believe this is a bug in the underlying resolution service, and we will notify upstream.
I also believe that SonarLint could be more resilient to this kind of bug, and I created a ticket that we will address as part of the next release.
Unfortunately I don’t see an easy workaround for VSCode. Please note that Eclipse and IntelliJ do not seem to be impacted by this issue (at least not with the reproducer project).