Incompatibility APIs with SonarQube 5.6 and Java Analyzer 4.0 with Findbugs 3.3 or Cobertura 1.6.3

Analysis of my projects fails with SonarQube 5.6 after updating the Java plugin from version 3.14 to 4.0 .

My SonarQube instance, among other plugins, currently has a Findbugs plugin (version 3.3 ) and a Cobertura plugin ( 1.6.3 ) that requires a Java plugin.

Looking at the log, I get the following message:

 [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.1-build231:sonar (default-cli) on project MyProject: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.1-build231:sonar failed: An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.1-build231:sonar: java.lang.NoSuchMethodError: org.sonar.plugins.java.api.JavaResourceLocator.findResourceByClassName(Ljava/lang/String;)Lorg/sonar/api/resources/Resource; ... Caused by: java.lang.NoSuchMethodError: org.sonar.plugins.java.api.JavaResourceLocator.findResourceByClassName(Ljava/lang/String;)Lorg/sonar/api/resources/Resource; at org.sonar.plugins.findbugs.FindbugsSensor.analyse(FindbugsSensor.java:108) at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58) at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50) at org.sonar.batch.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:83) at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:192) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127) at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:241) at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:236) at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:226) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127) at org.sonar.batch.task.ScanTask.execute(ScanTask.java:47) at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127) at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:106) at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119) at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:62) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60) at com.sun.proxy.$Proxy21.execute(Unknown Source) at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:240) at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151) at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute(ScannerBootstrapper.java:78) at org.sonarsource.scanner.maven.SonarQubeMojo.execute(SonarQubeMojo.java:112) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132) ... 20 more 

What should I do so that my analysis does not fail?

+7
java sonarqube findbugs
source share
2 answers

Version 4.0 SonarQube Java Analyzer Java has made changes to its API to stay consistent with the new SonarQube 5.6 LTS API (long-term support).

Unfortunately, these changes potentially violated plugin compatibility by relying directly on the Java analyzer. If the latest versions of the PMD and Checkstyle not affected, version 3.3 for Findbugs , unfortunately, is not compatible, as well as version 1.6.3 the Cobertura plugin.

To solve the problem with Findbugs, you have the following option:

  • Update to version> = 3.4 the Findbugs plugin, which is currently in the Request a feedback period ( see this topic ) and should be released soon ( confirmed with version 3.4.2 ).
  • Uninstall the Findbugs plugin or temporarily disable its rules.

For the Cobertura plugin, upgrade to version> = 1.7 (requires LTS 5.6 and Java 8) to fix the problem. The update must be available using the SonarQube user interface.

+12
source share

I had the same problem, updating cobertura-1.7 findbugs-3.4.3 and the Java versions of Analyzer-4.1 resolved the issue.

0
source share

All Articles