SQ 5.6 + Findbugs, with Jenkins + Sonarplugin

3,162 views
Skip to first unread message

gilbert...@googlemail.com

unread,
Jul 21, 2016, 10:23:50 AM7/21/16
to SonarQube
Hi,

Environment :
Sonarqube 5.6, Jenkins 1.642.18.1, SonarQube Plugin 2.4.4, Sonar Runner 2.4

Created a small Jenkins Job (Java sources, no compile) to test the interaction with  a fresh 5.6 LTS Installation.
All went fine until i installed sonar-findbugs-plugin-3.4.3, the next Jenkins Job failed with :

[..]
15:30:40
15:30:40.557 WARN - Findbugs needs sources to be compiled. Please build project before executing sonar or check the location of compiled classes to make it possible for Findbugs to analyse your project.
15:30:40
INFO: ------------------------------------------------------------------------
15:30:40 INFO: EXECUTION FAILURE 15:30:40 INFO: ------------------------------------------------------------------------
15:30:40 Total time: 23.042s 15:30:40 Final Memory: 28M/669M
15:30:40
INFO: ------------------------------------------------------------------------
15:30:40
ERROR: Error during Sonar runner execution
15:30:40
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
15:30:40
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
15:30:40
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
15:30:40
at java.security.AccessController.doPrivileged(Native Method)
15:30:40 at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
15:30:40 at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
15:30:40 at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
15:30:40
at org.sonar.runner.api.Runner.execute(Runner.java:100)
15:30:40 at org.sonar.runner.Main.executeTask(Main.java:70)
15:30:40
at org.sonar.runner.Main.execute(Main.java:59)
15:30:40
at org.sonar.runner.Main.main(Main.java:53)
15:30:40 Caused by: java.lang.IllegalStateException: Can not execute Findbugs
15:30:40
at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:169)
15:30:40
at org.sonar.plugins.findbugs.FindbugsSensor.execute(FindbugsSensor.java:88)
15:30:40
at org.sonar.batch.sensor.SensorWrapper.analyse(SensorWrapper.java:57)
15:30:40 at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58)
15:30:40
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50)
15:30:40
at org.sonar.batch.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:83)
15:30:40 at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:192)
15:30:40
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
15:30:40
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
15:30:40
at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:241)
15:30:40
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:236)
15:30:40 at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:226)
15:30:40 at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
15:30:40 at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
15:30:40
at org.sonar.batch.task.ScanTask.execute(ScanTask.java:47)
15:30:40
at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86)
15:30:40
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
15:30:40
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
15:30:40
at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:106)
15:30:40
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119)
15:30:40
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:79)
15:30:40
at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
15:30:40
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
15:30:40 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
15:30:40
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
15:30:40
at java.lang.reflect.Method.invoke(Method.java:497)
15:30:40
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
15:30:40
... 9 more15:30:40 Caused by: java.lang.IllegalStateException: This project contains Java source files that are not compiled.
15:30:40
at org.sonar.plugins.findbugs.FindbugsConfiguration.getFindbugsProject(FindbugsConfiguration.java:120)
15:30:40
at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:119)
[..]


The associated Sonarqube project has a Quality Profile without  Findbugs rules.
Used the same configuration with Sonarqube 5.4 / sonar-findbugs-3.3 and had no problems.

After downgrading Sonarqube 5.6 to sonar-findbugs-3.3 all works fine.
So it seems like Findbugs is responsible, maybe it needs only some other configuration
in the new version ?!

//Gilbert



philipp...@gmail.com

unread,
Jul 21, 2016, 12:06:17 PM7/21/16
to SonarQube
 - How does your source code is compiled? (Maven, Gradle, Ant, Makefile, ...)
 - What are the build steps?

gilbert...@googlemail.com

unread,
Jul 21, 2016, 3:58:24 PM7/21/16
to SonarQube
Hi,
as i wrote,no compile - only sources.
The quality profile has no Findbugs rules, so the plugin shouldn't get involved at all.

//Gilbert

philipp...@gmail.com

unread,
Jul 21, 2016, 6:01:23 PM7/21/16
to SonarQube

patroklos....@crossover.com

unread,
Aug 3, 2016, 2:33:21 AM8/3/16
to SonarQube
We get the same error with compiled sources and FindBugs rules enabled...
The same project with the same configuration was working fine with SonarQube 5.5

Any ideas?

nicolas....@gmail.com

unread,
Aug 4, 2016, 3:21:00 AM8/4/16
to SonarQube
How did you downgraded your version ? I got the following error when I downgrade from 3.4.3 to 3.3.

2016.08.04 08:55:14 ERROR web[o.a.c.c.C.[.[.[/]] Exception sending context initialized event to listener instance of class org.sonar.server.platform.PlatformServletContextListener
java.lang.IllegalArgumentException: The rule 'EC_INCOMPATIBLE_ARRAY_COMPARE' of repository 'findbugs' is declared several times
at org.sonar.api.internal.google.common.base.Preconditions.checkArgument(Preconditions.java:148) ~[sonar-plugin-api-5.6.jar:na]

gilbert...@googlemail.com

unread,
Aug 4, 2016, 4:56:42 AM8/4/16
to SonarQube, nicolas....@gmail.com
Hi,


How did you downgraded your version ? I got the following error when I downgrade from 3.4.3 to 3.3.

Stop Sonarqube service, replace the new findbugs 3.4.3 plugin jar in sonarqube-5.6\extensions\plugins\
with the older findbugs plugin jar 3.3, restart Sonarqube service.
Afterwards Jenkins job runs without errors.

//Gilbert

Nicolas Henneaux

unread,
Aug 4, 2016, 5:05:16 AM8/4/16
to gilbert...@googlemail.com, SonarQube
It did not work for me (I got the error "The rule 'EC_INCOMPATIBLE_ARRAY_COMPARE' of repository 'findbugs' is declared several times"). Anyway, I have made a pull request with the correction to the findbugs sonar plugin repository (https://github.com/SonarQubeCommunity/sonar-findbugs/pull/39).

mdmsh...@gmail.com

unread,
Aug 4, 2016, 5:55:02 AM8/4/16
to SonarQube
Hi,

After upgrading to SonarQube 5.6, findbugs-3.4.3 and Cobertura-1.6.3

we are facing below issues

SonarQube analysis fails with the following error -

{{INFO - parsing ..../...../cobertura/coverage.xml

ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:53)
Caused by: java.lang.NoSuchMethodError: org.sonar.plugins.java.api.JavaResourceLocator.findResourceByClassName(Ljava/lang/String;)Lorg/sonar/api/resources/Resource;}}

So upgraded to cobertura-1.7 then started facing the below error message


Findbugs needs sources to be compiled. Please build project before executing sonar or check the location of compiled classes to make it possible for Findbugs to analyse your project.
java.lang.IllegalStateException: This project contains Java source files that are not compiled.

Note: we have findbug rules enabled and also compiled but it still fails with above issue. Please help me in fixing this issue.


ovidiu.t...@qualitance.com

unread,
Oct 25, 2016, 10:53:26 AM10/25/16
to SonarQube
Hi,

   Downgrading to sonar-findbugs-3.3 worked for me also,


On Thursday, July 21, 2016 at 5:23:50 PM UTC+3, gilbert...@googlemail.com wrote:

David Grierson

unread,
Nov 16, 2016, 9:21:42 AM11/16/16
to SonarQube, philipp...@gmail.com
According to that bug report that is closed because your code now detects whether or not the FindBugs rules are enabled.

However there doesn't appear to be any simple way to identify what FindBugs rules are enabled for a particular Quality Profile

Can you outline how that can be achieved?

Thanks,

David.

G. Ann Campbell

unread,
Nov 16, 2016, 9:55:01 AM11/16/16
to SonarQube, philipp...@gmail.com
Hi David,

Just add the Repository facet to your rule search:




Ann

kavith...@gmail.com

unread,
Feb 17, 2017, 3:39:05 PM2/17/17
to SonarQube, mdmsh...@gmail.com
Hi,

I have same issue now with 5.6.5 Sonar and 3.4.4 findbugs plugin.

Were you able to resolve your issue? if yes, can you provide that info? 

mdmsh...@gmail.com

unread,
Feb 19, 2017, 9:48:29 AM2/19/17
to SonarQube, mdmsh...@gmail.com, kavith...@gmail.com
Hi,

Yes, I fixed the issue by adding sonar.java.binaries=target/classes in sonar-project.properties.

Regards,
Sharieff.

h.far...@gmail.com

unread,
Feb 24, 2017, 5:51:24 AM2/24/17
to SonarQube, mdmsh...@gmail.com, kavith...@gmail.com
Hi!

Is there any other place where I can specify this parameter? (In sonar properies file, Jenkins job or elsewhere) 
I don't have any sonar-project.properties in my project and it works fine with sonar 4.5.
Now with 5.6.6 sonar and 3.4.4 FindBugs plugin I can't find where to place this parameter.

Regard,
Oleksii.
Reply all
Reply to author
Forward
0 new messages