Csharp代码质量分析过程中出错

时间:2011-09-13 06:44:36

标签: sonarqube

通过“mvn sonar:sonar”命令启动质量分析时出现以下错误。

可能对您有所帮助的信息很少。

  1. 声纳版本:2.9
  2. 在.sln文件所在的同一目录中创建了POM.xml
  3. .sln文件包含我想要进行质量分析的Csharp代码。
  4. Sonar正在使用默认德比
  5. 异常信息

    [INFO]  Excluded sources : [**/Reference.cs, **/*.designer.cs, **/*.Designer.cs]
    [INFO]  Selected quality profile : [name=Sonar C# Way,language=cs]
    [INFO]  Loading i18n bundles
    [INFO]  Compare to previous analysis (2011-09-08)
    [INFO]  Compare over 5 days (2011-09-08, analysis of 2011-09-08 19:02:00.235)
    [INFO]  Compare over 30 days (2011-08-14, analysis of 2011-09-08 19:02:00.235)
    [INFO]  Gallio won't execute as there are no test projects.
    [INFO]  Configure maven plugins...
    [INFO]  Sensor AsynchronousMeasuresSensor...
    [INFO]  Sensor AsynchronousMeasuresSensor done: 16 ms
    [INFO]  Sensor org.sonar.plugins.csharp.core.CSharpSourceImporter@1125a40...
    [INFO]  Sensor org.sonar.plugins.csharp.core.CSharpSourceImporter@1125a40 done:
    188 ms
    [INFO]  Sensor com.sonar.plugins.csharp.squid.C@155aa19...
    [INFO]  Sensor com.sonar.plugins.csharp.squid.C@155aa19 done: 1609 ms
    [INFO]  Sensor org.sonar.plugins.csharp.gendarme.GendarmeSensor@1df3bec...
    [INFO]  Gendarme executable not found: 'C:\Program Files\gendarme-2.10-bin\genda
    rme.exe'. The embedded version (2.10) will be used instead.
    [INFO]  Skipping the non generated assembly of project : BusinessLogic
    [INFO] ------------------------------------------------------------------------
    [ERROR] BUILD ERROR
    [INFO] ------------------------------------------------------------------------
    [INFO] Can not execute Sonar
    
    Embedded error: No assembly to scan. Please check your project's Gendarme plugin
     configuration.
    [INFO] ------------------------------------------------------------------------
    [INFO] Trace
    org.apache.maven.lifecycle.LifecycleExecutionException: Can not execute Sonar
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:284)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
            at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
            at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
            at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
            at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
            at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
            at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
    
            at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
    Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute Sonar
    
            at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:103)
    
            at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:79)
            at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:88)
            at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
            ... 17 more
    Caused by: java.lang.IllegalStateException: No assembly to scan. Please check your project's Gendarme plugin configuration.
            at org.sonar.dotnet.tools.gendarme.GendarmeCommandBuilder.validate(GendarmeCommandBuilder.java:263)
            at org.sonar.dotnet.tools.gendarme.GendarmeCommandBuilder.toCommand(GendarmeCommandBuilder.java:177)
            at org.sonar.dotnet.tools.gendarme.GendarmeRunner.execute(GendarmeRunner.java:133)
            at org.sonar.plugins.csharp.gendarme.GendarmeSensor.launchGendarme(GendarmeSensor.java:149)
            at org.sonar.plugins.csharp.gendarme.GendarmeSensor.analyse(GendarmeSensor.java:115)
            at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:63)
            at org.sonar.batch.phases.Phases.execute(Phases.java:93)
            at org.sonar.batch.bootstrap.ProjectModule.doStart(ProjectModule.java:145)
            at org.sonar.batch.bootstrap.Module.start(Module.java:89)
            at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:106)
            at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:101)
            at org.sonar.batch.bootstrap.BatchModule.doStart(BatchModule.java:96)
            at org.sonar.batch.bootstrap.Module.start(Module.java:89)
            at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.java:96)
            at org.sonar.batch.bootstrap.Module.start(Module.java:89)
            at org.sonar.batch.Batch.execute(Batch.java:74)
            at org.sonar.maven.SonarMojo.executeBatch(SonarMojo.java:154)
            at org.sonar.maven.SonarMojo.execute(SonarMojo.java:143)
            at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
            at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:98)
            ... 21 more
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 9 seconds
    [INFO] Finished at: Tue Sep 13 10:52:39 IST 2011
    [INFO] Final Memory: 15M/34M
    

1 个答案:

答案 0 :(得分:0)

我的第一个猜测是,在声纳分析之前,您的解决方案从未构建过。使用您感觉舒适的任何工具构建解决方案,例如msbuild然后重试mvn sonar:sonar。

如果不起作用,请向用户邮件列表寻求帮助:http://www.sonarsource.org/support/support/