1
回答
sonar-runner分析代码出错了org.sonar.api.resources.Project.getPom
利用AWS快速构建适用于生产的无服务器应用程序,免费试用12个月>>>   
Exception in thread "main" java.lang.NoSuchMethodError: org.sonar.api.resources.Project.getPom()Lorg/apache/maven/
        at org.sonar.plugins.surefire.api.SurefireUtils.getReportsDirectoryFromPluginConfiguration(SurefireUtils.j
        at org.sonar.plugins.surefire.api.SurefireUtils.getReportsDirectory(SurefireUtils.java:39)
        at org.sonar.plugins.surefire.SurefireSensor.analyse(SurefireSensor.java:63)
        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.PhaseExecutor.execute(PhaseExecutor.java:98)
        at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:192)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:100)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:85)
        at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:258)
        at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:253)
        at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:243)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:100)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:85)
        at org.sonar.batch.bootstrap.GlobalContainer.executeAnalysis(GlobalContainer.java:153)
        at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:110)
        at org.sonar.runner.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:483)
        at org.sonar.runner.impl.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:61)
        at com.sun.proxy.$Proxy0.execute(Unknown Source)
        at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:275)
        at org.sonar.runner.api.EmbeddedRunner.runAnalysis(EmbeddedRunner.java:166)
        at org.sonar.runner.api.EmbeddedRunner.runAnalysis(EmbeddedRunner.java:153)
        at org.sonar.runner.cli.Main.runAnalysis(Main.java:118)
        at org.sonar.runner.cli.Main.execute(Main.java:80)
        at org.sonar.runner.cli.Main.main(Main.java:66)



是那里的配置有问题吗?
举报
鱼中鱼
发帖于2年前 1回/906阅
共有1个答案 最后回答: 2年前
修改了该类的方法:
private static File getReportsDirectoryFromPluginConfiguration(Project project) {
   /*
    MavenPlugin plugin = MavenPlugin.getPlugin(project.getPom(), MavenSurefireUtils.GROUP_ID, MavenSurefireUtils.ARTIFACT_ID);
    if (plugin != null) {
      String path = plugin.getParameter("reportsDirectory");
      if (path != null) {
        return project.getFileSystem().resolvePath(path);
      }
    }*/
    return null;

  }




可以完成分析任务,但是并没有入库,是sonar.jdbc.username配置已失效。

顶部