galexandre / sonar-cobertura

Cobertura plugin for SonarQube
GNU General Public License v3.0
30 stars 26 forks source link

Fix compatibility with Java Plugin 4.0 #5

Closed m-g-sonar closed 8 years ago

m-g-sonar commented 8 years ago

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.

The method is used in the CoberturaReportParser, Line #82.

[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;