Skip to content

Commit

Permalink
Fix NoSuchMethodException in getReportsDirectory
Browse files Browse the repository at this point in the history
After building the "sonar scala" plugin from master, and installing in Sonar v4.1.1, I received the following error when running mvn sonar:sonar

java.lang.NoSuchMethodError: org.sonar.plugins.surefire.api.SurefireUtils.getReportsDirectory(Lorg/sonar/api/resources/Project;)Ljava/io/File;
at org.sonar.plugins.scala.surefire.SurefireSensor.analyse(SurefireSensor.java:51)
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:72)

The "objective-c plugin" hit the same issue which they fixed here:
https://github.com/drewcrawford/sonar-objective-c/commit/ec68e769aef8675eb3f5a748d853741461c5d9c6

I modified their solution to use getFileSystem().resolvePath so that Maven multi-module builds will also work.
  • Loading branch information
scosenza committed Feb 8, 2014
1 parent 2d1085f commit 3ea8c2b
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.api.CoreProperties;
import org.sonar.api.batch.CoverageExtension;
import org.sonar.api.batch.DependsUpon;
import org.sonar.api.batch.Sensor;
Expand Down Expand Up @@ -48,8 +49,9 @@ public boolean shouldExecuteOnProject(Project project) {
}

public void analyse(Project project, SensorContext context) {
File dir = SurefireUtils.getReportsDirectory(project);
collect(project, context, dir);
String path = (String) project.getProperty(CoreProperties.SUREFIRE_REPORTS_PATH_PROPERTY);
File pathFile = project.getFileSystem().resolvePath(path);
collect(project, context, pathFile);
}

protected void collect(Project project, SensorContext context, File reportsDir) {
Expand Down

0 comments on commit 3ea8c2b

Please sign in to comment.