简体   繁体   English

Maven + .NET + Sonar v4.5.1 + Visual Studio项目的分析引导程序

[英]Maven + .NET + Sonar v4.5.1 + Analysis Bootstrapper for Visual Studio Projects

I am trying to run a sonar(v 4.5.1) build for .NET C# project using Maven 3.2.3. 我正在尝试使用Maven 3.2.3为.NET C#项目运行一个声纳(v 4.5.1)构建。 I face the following error and struck here with this and not able to proceed further. 我遇到以下错误,并在此发生了错误,无法继续进行。

Error Log: 错误日志:

[INFO] [13:06:21.552] The import of some StyleCop issues were skipped. See DEBUG logs for details.
[INFO] [13:06:21.553] Sensor org.sonar.plugins.stylecop.StyleCopSensor@19bcfc1 done: 11995 ms
[INFO] [13:06:21.555] Sensor JMeterSensor...
[INFO] [13:06:21.555] Sensor JMeterSensor done: 0 ms
[INFO] [13:06:21.555] Sensor org.sonar.plugins.csharp.squid.CSharpSquidSensor@58aa13...
[INFO] [13:06:21.607] 53 source files to be analyzed
[INFO] [13:06:22.291] 53/53 source files analyzed
[INFO] [13:06:22.352] Sensor org.sonar.plugins.csharp.squid.CSharpSquidSensor@58aa13 done: 797 ms
[INFO] [13:06:22.352] Sensor org.sonar.plugins.csharp.core.CSharpFxCopProvider$CSharpFxCopSensor@1060218...
[DEBUG] [13:06:22.354] Release semaphore on project : org.sonar.api.resources.Project@1c60683[id=10140,key=OrgName:ProjectName,qualifier=TRK], with key batch-OrgName:ProjectName
[ERROR] The property "sonar.cs.fxcop.assembly" must be set and the project must have been built to execute FxCop rules. This property can be automatically set by the Analysis Bootstrapper for Visual Studio Projects plugin, see: http://docs.codehaus.org/x/TAA1Dg.If you wish to skip the analysis of not built projects, set the property "sonar.visualstudio.skipIfNotBuilt".
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:16 min
[INFO] Finished at: 2014-12-23T13:06:22-08:00
[INFO] Final Memory: 17M/130M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.sonar:sonar-maven-plugin:4.5.1:sonar (default-cli) on project OrgName:ProjectName: The property "sonar.cs.fxcop.assembly" must be set and the project must have been built to execute FxCop rules. This property can be automatically set by the Analysis Bootstrapper for Visual Studio Projects plugin, see: http://docs.codehaus.org/x/TAA1Dg.If you wish to skip the analysis of not built projects, set the property "sonar.visualstudio.skipIfNotBuilt". -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.sonar:sonar-maven-plugin:4.5.1:sonar (default-cli) on project OrgName-ProjectName: The property "sonar.cs.fxcop.assembly" must be set and the project must have been built to execute FxCop rules. This property can be automatically set by the Analysis Bootstrapper for Visual Studio Projects plugin, see: http://docs.codehaus.org/x/TAA1Dg.If you wish to skip the analysis of not built projects, set the property "sonar.visualstudio.skipIfNotBuilt".
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: The property "sonar.cs.fxcop.assembly" must be set and the project must have been built to execute FxCop rules. This property can be automatically set by the Analysis Bootstrapper for Visual Studio Projects plugin, see: http://docs.codehaus.org/x/TAA1Dg. If you wish to skip the analysis of not built projects, set the property "sonar.visualstudio.skipIfNotBuilt".
        at org.sonar.maven.ExceptionHandling.handle(ExceptionHandling.java:37)
        at org.sonar.maven.SonarMojo.execute(SonarMojo.java:175)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        ... 19 more
Caused by: java.lang.IllegalArgumentException: The property "sonar.cs.fxcop.assembly" must be set and the project must have been built to execute FxCop rules. This property can be automatically set by the Analysis Bootstrapper for Visual Studio Projects plugin, see: http://docs.codehaus.org/x/TAA1Dg. If you wish to skip the analysis of not built projects, set the property "sonar.visualstudio.skipIfNotBuilt".
        at org.sonar.plugins.fxcop.FxCopConfiguration.checkMandatoryProperties(FxCopConfiguration.java:94)
        at org.sonar.plugins.fxcop.FxCopConfiguration.checkProperties(FxCopConfiguration.java:86)
        at org.sonar.plugins.fxcop.FxCopSensor.analyse(FxCopSensor.java:91)
        at org.sonar.plugins.fxcop.FxCopSensor.analyse(FxCopSensor.java:86)
        at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:79)
        at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:70)
        at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:119)
        at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:194)
        at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
        at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
        at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:233)
        at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:228)
        at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:226)
        at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:221)
        at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
        at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
        at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:64)
        at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:51)
        at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:125)
        at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
        at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
        at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:173)
        at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:95)
        at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
        at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
        at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
        at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
        at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
        at org.sonar.runner.api.Runner.execute(Runner.java:100)
        at org.sonar.maven.SonarMojo.execute(SonarMojo.java:173)
        ... 21 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

When i set the property to 当我将属性设置为

sonar.visualstudio.skipIfNotBuilt=true

I get the error like this. 我得到这样的错误。

[ERROR] No Visual Studio projects were found.

My pom.xml configurations are, 我的pom.xml配置是,

    <sonar.visualstudio.enable>true</sonar.visualstudio.enable>
    <sonar.dotnet.visualstudio.solution.file>projetName.sln</sonar.dotnet.visualstudio.solution.file>
    <visual.test.project.pattern>*.Tests</visual.test.project.pattern>
    <dotnet.tool.version>4.5</dotnet.tool.version>
    <sonar.language>cs</sonar.language>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <sonar.cs.fxcop.fxCopCmdPath><program_files>/Fxcop/FxCopCmd.exe</sonar.cs.fxcop.fxCopCmdPath>
    <sonar.stylecop.msBuildPath>C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe</sonar.stylecop.msBuildPath>
    <sonar.stylecop.styleCopDllPath><program_files>/StyleCop 4.7/StyleCop.dll</sonar.stylecop.styleCopDllPath>
    <sonar.fxcop.installDirectory><program_files>/Fxcop</sonar.fxcop.installDirectory>  

Please suggest me a solution for this. 请为我建议一个解决方案。

I finally resolved having entry for fxcop assembly for all my sub modules. 我终于解决了为所有子模块进行fxcop组装的条目。

sonar.cs.fxcop.assembly=subproject1/bin/Debug/subproject1.dll
sonar.cs.fxcop.assembly=subproject2/bin/Debug/subproject2.dll  
sonar.cs.fxcop.assembly=subproject3/bin/subproject3.dll

I would try setting one of the below properties. 我会尝试设置以下属性之一。 I am not sure what type of application you are building, but i could not get my MVC project to pass this step without setting the fxcop directories property to be my lib folder or the bin output folder. 我不确定要构建哪种类型的应用程序,但是如果不将fxcop directorys属性设置为我的lib文件夹或bin输出文件夹,就无法使我的MVC项目通过此步骤。

sonar.cs.fxcop.directories=
sonar.visualstudio.outputPaths=

and change your visual studio solution property to the following 并将Visual Studio解决方案属性更改为以下内容

sonar.visualstudio.solution=projetName.sln

http://docs.sonarqube.org/display/SONAR/Analysis+Bootstrapper+for+Visual+Studio+Projects+Plugin http://docs.sonarqube.org/display/SONAR/Analysis+Bootstrapper+for+Visual+Studio+Projects+Plugin

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我可以使用Visual Studio Analysis Bootstrapper在Sonar中分析C#测试项目吗? - Can I analyze C# test projects in Sonar using the Visual Studio Analysis Bootstrapper? 无法解决.NET Framework版本= v4.5.1的程序包错误 - Unable to resolve package error for .NET Framework, Version=v4.5.1 MSBuild TargetFrameworkVersion = v4.5.1目标.Net Framework v4.0 - MSBuild TargetFrameworkVersion = v4.5.1 targets .Net Framework v4.0 .Net 框架项目上的 Visual Studio 代码分析 - Visual Studio Code Analysis on .Net Framework Projects OData库v4与v4.5.1的命名空间 - Namespace for OData libraries v4 vs v4.5.1 此工具集不支持TargetFrameworkVersion&#39;v4.5.1&#39;(ToolsVersion:4.0) - TargetFrameworkVersion 'v4.5.1' not supported by this toolset (ToolsVersion: 4.0) 如何将所有解决方案项目 .Net framework 4.5.1 升级到 4.8 Visual Studio 2019 - How to upgrade all solution projects .Net framework 4.5.1 to 4.8 Visual Studio 2019 在Visual Studio 2013中从.NET 3.5迁移到4.5.1 - Migrating from .NET 3.5 to 4.5.1 in Visual Studio 2013 Visual Studio项目的.NET类? - .NET classes for Visual Studio projects? .net核心项目的声纳分析 - sonar analysis for .net core project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM