SonarQube:请提供项目的编译类

时间:2018-04-09 09:08:55

标签: java sonarqube

我正在运行Sonar Qube 6.5并使用Sonar扫描仪3.0.3。

当我为我的项目运行声纳扫描仪时,我遇到如下错误:

ERROR: Error during SonarQube Scanner execution
org.sonar.squidbridge.api.AnalysisException: Please provide compiled classes of your project with sonar.java.binaries property
        at org.sonar.java.JavaClasspath.init(JavaClasspath.java:59)
        at org.sonar.java.AbstractJavaClasspath.getElements(AbstractJavaClasspath.java:281)
        at org.sonar.java.SonarComponents.getJavaClasspath(SonarComponents.java:141)
        at org.sonar.java.JavaSquid.<init>(JavaSquid.java:83)
        at org.sonar.plugins.java.JavaSquidSensor.execute(JavaSquidSensor.java:83)
        at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
        at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:88)
        at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:82)
        at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:68)
        at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:78)
        at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:179)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:144)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:129)
        at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:261)
        at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:256)
        at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:245)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:144)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:129)
        at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:47)
        at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:84)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:144)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:129)
        at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:119)
        at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:116)
        at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:63)
        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.$Proxy0.execute(Unknown Source)
        at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:233)
        at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)
        at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:123)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:77)
        at org.sonarsource.scanner.cli.Main.main(Main.java:61)

ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.

1 个答案:

答案 0 :(得分:0)

我不知道你是如何执行SonarQube分析的,因为你有雾天与我们分享这些信息。

无论如何,这就是你如何使用你自己的声纳安装在localhost上的方式:

  1. here
  2. 下载SonarQube
  3. 解压
  4. 刷新Java插件,您可以从here
  5. 下载插件
      

    在专用于您要安装的插件的页面中(例如:对于Python:SonarPython),单击与SonarQube版本兼容的版本的“下载”链接。将下载的jar文件上传到SonarQube服务器并将其放在目录中:$ SONARQUBE_HOME / extensions / plugins。如果已存在同一插件的另一个版本,则需要将其删除,因为只有给定插件的一个版本可能是可在extensions / plugins目录中找到。

    1. 启动SonarQube:\ bin \ windows-x86-64 \ StartSonar.bat

    2. 登录SonarQube

    3. 检查Java插件版本:访问管理&gt;系统&gt;更新中心&gt; SonarJava菜单

    4. 执行以下maven任务,它还会生成代码质量和代码覆盖率报告:

    5.   

      mvn -e -B org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:声纳   -Dsonar.host.url = http://localhost:9000

      1. 代码覆盖率报告
      2. 您可以找到有关代码覆盖率插件配置here的更多详细信息。