spotbugs / sonar-findbugs

SpotBugs plugin for SonarQube
358 stars 138 forks source link

Can not execute Findbugs #1042

Open Mos26 opened 3 weeks ago

Mos26 commented 3 weeks ago

Hi We faced an issue when we installed Findbugs, Could you please help us to resolved the issue?

| ------------------ | ------- | | SonarQube | 10.6 | | Sonar-FindBugs | 4.2.10 | | Java |17|

Error:

15:14:56.688 ERROR: Error during SonarScanner execution 15:14:56.687 INFO: Final Memory: 53M/180M 15:14:56.688 INFO: ------------------------------------------------------------------------ java.lang.IllegalStateException: Can not execute Findbugs at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:191) at org.sonar.plugins.findbugs.FindbugsSensor.execute(FindbugsSensor.java:132) at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64) at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:88)

gtoison commented 3 weeks ago

Can you please share more of the logs? There should be more details before and after this error

Mos26 commented 3 weeks ago

Hi @gtoison Please find the attachment. logs_636556.zip

gtoison commented 3 weeks ago

The relevant error message is:

2024-10-29T15:14:56.7133072Z Caused by: java.lang.IllegalStateException: One (sub)project contains Java source files that are not compiled (D:\a\1\s).
2024-10-29T15:14:56.7133566Z Project has java source file(s), they must be compiled to be analyzed.
2024-10-29T15:14:56.7134033Z Property sonar.java.binaries was not set, it is required to locate the compiled .class files. For instance set the property to: sonar.java.binaries=target/classes
2024-10-29T15:14:56.7134614Z Sonar JavaResourceLocator.classpath was empty
2024-10-29T15:14:56.7135085Z Sonar JavaResourceLocator.classFilesToAnalyze was empty
2024-10-29T15:14:56.7135565Z    at org.sonar.plugins.findbugs.FindbugsConfiguration.buildMissingCompiledCodeException(FindbugsConfiguration.java:175)
2024-10-29T15:14:56.7136109Z    at org.sonar.plugins.findbugs.FindbugsConfiguration.initializeFindbugsProject(FindbugsConfiguration.java:139)
2024-10-29T15:14:56.7136625Z    at org.sonar.plugins.findbugs.FindbugsConfiguration.initializeFindbugsProject(FindbugsConfiguration.java:102)
2024-10-29T15:14:56.7137117Z    at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:117)
2024-10-29T15:14:56.7137479Z    ... 34 more

There are sources (java, kotlin, jsp, ...) in a project but the plugin could not find the corresponding .class files SpotBugs analyses the .class files, not the sources so the project needs to be compiled before analysis

Mos26 commented 3 weeks ago

@gtoison But before installing this plugin we didn't have any issues. Is it possible to ignore it, and if so, how?

gtoison commented 3 weeks ago

You can set sonar.findbugs.allowuncompiledcode=true if your code is not compiled, in that case SpotBugs won't analyze it