Hi,
SonarLint needs to access the project classpath to analyze your Java files. To do that we are querying the VSCode Java extension. Could you check you are using a recent version of vscode-java?
Also be sure your project is totally imported.
If that still doesn’t work, please enable both Java LSP debug logs (by settings property java.trace.server
to verbose
). This will show very verbose messages in the “Language Server for Java” Output.
If everything works fine, you should fins in logs something like:
[Trace - 09:47:29] Sending request 'workspace/executeCommand - (45)'.
Params: {
"command": "java.project.getClasspaths",
"arguments": [
"file:///c%3A/Prog/Projects/scanners/sonar-scanner-cli/src/main/java/org/sonarsource/scanner/cli/Main.java",
"{\"scope\":\"runtime\"}"
]
}
Then the response:
[Trace - 09:47:29] Received response 'workspace/executeCommand - (45)' in 17ms.
Result: {
"projectRoot": "file:/C:/Prog/Projects/scanners/sonar-scanner-cli",
"classpaths": [
"C:\\Prog\\Projects\\scanners\\sonar-scanner-cli\\target\\classes",
"C:\\Users\\Julien\\.m2\\repository\\org\\sonarsource\\scanner\\api\\sonar-scanner-api\\2.10.0.1189\\sonar-scanner-api-2.10.0.1189.jar",
"C:\\Users\\Julien\\.m2\\repository\\com\\google\\code\\findbugs\\jsr305\\2.0.3\\jsr305-2.0.3.jar"
],
"modulepaths": []
}