Csharp 代码质量分析期间出错

发布于 2024-12-04 04:39:13 字数 5976 浏览 1 评论 0原文

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

一些信息可能对您有帮助。

  1. 声纳版本:2.9
  2. 在 .sln 文件所在的同一目录中创建了 POM.xml
  3. .sln 文件具有我想要对其进行质量分析的 Csharp 代码。
  4. Sonar 正在使用默认的 derby

异常信息

[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

I am getting following error while launching quality analysis via "mvn sonar:sonar" command.

Few info which might be helpful to you.

  1. Sonar Version:2.9
  2. Created POM.xml at the same dir where .sln file resides
  3. .sln file has Csharp code for which i want to do quality analysis.
  4. Sonar is using default derby

Exception information

[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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

假面具 2024-12-11 04:39:13

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

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

My first guess is that your solution has never been build prior tot he sonar analysis. Build your solution with whatever tool you feel comfortable, msbuild for example then retry mvn sonar:sonar.

If that does not work, ask for help to the user mailing list : http://www.sonarsource.org/support/support/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文