The Java plugin 4.0 slightly changed its API in order to align with new SonarQube LTS API. The Ccobertura plugin, relying on the Java Analyzer, has to adapt consequently, as analyzes will fail.
For the change of API, see line Line #40 of the Java plugin. Prior to the change, the method findResourceByClassName() was returning a org.sonar.api.resources.Resource. Now it is returning an org.sonar.api.batch.fs.InputFile.
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.1-build231:sonar (default-cli)
on project HeadShot-java8: 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;
The Java plugin 4.0 slightly changed its API in order to align with new SonarQube LTS API. The Ccobertura plugin, relying on the Java Analyzer, has to adapt consequently, as analyzes will fail.
For the change of API, see line Line #40 of the Java plugin. Prior to the change, the method
findResourceByClassName()
was returning aorg.sonar.api.resources.Resource
. Now it is returning anorg.sonar.api.batch.fs.InputFile
.The method is used in the CoberturaReportParser, Line #82.