分析期间SonarQube错误 - 缺少属性。但我应该设置什么属性?

时间:2017-11-13 12:40:51

标签: c++ jenkins sonarqube pipeline sonarqube-scan

我正试图在我的项目上进行声纳分析。我一直收到这个错误。错误说有一个缺失的属性。代码是c ++,我还在属性文件中添加了测试路径和源目录路径。但我不确定它所指的是什么财产。请指导!!!

14:10:11.010 INFO: 1072 files indexed
14:10:11.010 INFO: 1718 files ignored because of inclusion/exclusion patterns
   14:10:11.079 INFO: Quality profile for cpp: CleanSweep
   14:10:11.436 DEBUG: Code colorizer, supported languages: 
   14:10:12.852 DEBUG: 'C' skipped because there is no related file in current project
   14:10:12.853 DEBUG: 'Objective-C' skipped because there is no related file in current project
   14:10:12.853 DEBUG: 'gcov' skipped because one of the required properties is missing
   14:10:12.853 DEBUG: 'llvm-cov' skipped because one of the required properties is missing
    14:10:12.853 DEBUG: 'cppunit' skipped because one of the required properties is missing
    14:10:12.854 DEBUG: 'VisualStudioCoverage' skipped because one of the required properties is missing
   14:10:12.854 DEBUG: 'bullseye' skipped because one of the required properties is missing
    14:10:12.854 DEBUG: 'FxCop (cs)' skipped because there is no related file in current project
    14:10:12.855 DEBUG: 'FxCop (vbnet)' skipped because there is no related file in current project
   14:10:12.856 DEBUG: 'JavaScript Squid Sensor' skipped because there is no related file in current project
   14:10:12.856 DEBUG: 'C#' skipped because there is no related file in current project
    14:10:12.857 DEBUG: 'C# Unit Tests Coverage Report Import' skipped because there is no related file in current project
    14:10:12.858 DEBUG: 'C# Integration Tests Coverage Report Import' skipped because there is no related file in current project
 14:10:12.858 DEBUG: 'C# Unit Test Results Import' skipped because there is no related file in current project
  14:10:12.859 DEBUG: 'SurefireSensor' skipped because there is no related file in current project
  14:10:12.860 DEBUG: 'JaCoCoSensor' skipped because there is no related file in current project
   14:10:12.860 DEBUG: 'JaCoCoItSensor' skipped because there is no related file in current project
   14:10:12.861 DEBUG: 'JaCoCoOverallSensor' skipped because there is no related file in current project
  14:10:12.861 DEBUG: 'JavaSquidSensor' skipped because there is no related file in current project
14:10:12.862 DEBUG: 'Linting sensor for TypeScript files' skipped because there is no related file in current project
 14:10:12.863 DEBUG: 'Combined LCOV and LOC sensor' skipped because there is no related file in current project
  14:10:12.869 DEBUG: Sensors : Lines Sensor (wrapped) -> com.stevpet.sonar.plugins.dotnet.mscover.failfast.FailFastSensor@370c9018 -> SCM Sensor (wrapped) -> C++ (wrapped) -> SonarJavaXmlFileSensor (wrapped) -> Zero Coverage Sensor (wrapped) -> Code Colorizer Sensor (wrapped) -> CPD Block Indexer (wrapped)
  14:10:12.894 INFO: devcockpit licensed to Software, PRODUCTION [Expiration: 2018-03-27, Server: 170e60000c88925]
  14:10:12.921 INFO: cpp licensed to Software, PRODUCTION [Expiration: 2018-09-27, Server: 170e60000c88925]
 14:10:12.926 INFO: Sensor Lines Sensor (wrapped)
 14:10:13.111 INFO: Sensor Lines Sensor (wrapped) (done) | time=185ms
  14:10:13.111 INFO: Sensor com.stevpet.sonar.plugins.dotnet.mscover.failfast.FailFastSensor
    14:10:13.117 INFO: ------------------------------------------------------------------------
  14:10:13.117 INFO: EXECUTION FAILURE
  14:10:13.117 INFO: ------------------------------------------------------------------------
   14:10:13.118 INFO: Total time: 13.853s
   14:10:13.258 INFO: Final Memory: 53M/313M
   14:10:13.258 INFO: ------------------------------------------------------------------------
   14:10:13.258 ERROR: Error during SonarQube Scanner execution
                                                                                         com.stevpet.sonar.plugins.dotnet.mscover.property.InvalidPropertyValueException:      Missing property
sonar.mscover.integrationtests.dir
 property is required, and parent must exist
    at  com.stevpet.sonar.plugins.dotnet.mscover.property.CoverageRootProperty.onGetValue(CoverageRootProperty.java:51)
    at    com.stevpet.sonar.plugins.dotnet.mscover.property.CoverageRootProperty.onGetValue(CoverageRootProperty.java:29)
    at com.stevpet.sonar.plugins.dotnet.mscover.property.ConfigurationPropertyBase.getValue(ConfigurationPropertyBase.java:49)
    at  com.stevpet.sonar.plugins.dotnet.mscover.property.ConfigurationPropertyBase.validate(ConfigurationPropertyBase.java:55)
     at com.stevpet.sonar.plugins.dotnet.mscover.DefaultIntegrationTestsConfiguration.validate(DefaultIntegrationTestsConfiguration.java:121)
    at com.stevpet.sonar.plugins.dotnet.mscover.failfast.FailFastSensor.analyse(FailFastSensor.java:55)
   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.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:83)
    at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:192)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
    at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:241)
       at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:236)
     at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:226)
     at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
      at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
      at org.sonar.batch.task.ScanTask.execute(ScanTask.java:47)
     at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86)
     at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
       at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:106)
      at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119)
         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)
     14:10:13.262 DEBUG: Execution getVersion
    14:10:13.263 DEBUG: Execution stop
   [Pipeline] }
   [Pipeline] // withSonarQubeEnv
   [Pipeline] }
   [Pipeline] // stage
   [Pipeline] echo
   project build error: hudson.AbortException: script returned exit code 1
   [Pipeline] step

我的声纳属性文件是

    # must be unique in a given SonarQube instance
    sonar.projectKey=server
    # this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
    sonar.projectName=server
    sonar.projectVersion=1.0

     # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
     # This property is optional if sonar.modules is set. 
    sonar.sources=.

    # language
    sonar.language=cpp

   # path to test source directories

    sonar.test.inclusions=**/UnitTest/**

    sonar.test.reportPath=**/test_result.xml


    # Encoding of the source code. Default is default system encoding
    sonar.sourceEncoding=UTF-8

1 个答案:

答案 0 :(得分:0)

日志说:

  

缺少属性sonar.mscover.integrationtests.dir属性是必需的,父级必须存在

此属性由sonar-mscover插件使用。

它应该指向存储集成测试的目录。

您可以通过在sonar.mscover.integrationtests.mode=文件中添加一行sonar.properties来停用此插件。