.NET プロジェクトを分析するために Maven と Sonar をセットアップしましたが、winforms プロジェクトでは問題なく動作します。ただし、MVC プロジェクトを追加すると、System.Web.MVC.dll ファイルが見つからないため、ビルドに失敗します。Sonar の一部として実行される Fx-Cop プラグインがあります。これを回避する 1 つの方法は、dll をパッケージ化し、local= true をプロジェクトにコピーすることです。しかし、私はそれをしたくありません(MVCファイルを一緒にパッケージ化することに何か問題がありますか?)
MVC dll に依存関係を追加するにはどうすればよいですか? この例に従い、次のように追加しました。
<dependencies>
<dependency>
<groupId>artifact_group_id</groupId>
<artifactId>System.WEb.MVC</artifactId>
<version>4.0.30319</version>
<type>library</type>
<scope>system</scope>
<systemPath>C:\DOTNET\DLLS\System.Web.Mvc.dll</systemPath>
</dependency>
</dependencies>
それでも FX-Cop が原因で Build Failure が発生します。FX-Cop ログを見ると、次のようなメッセージが表示されます。
モジュール 'MyTestMvcApp' の読み取り中に次のエラーが発生しました: アセンブリ参照を解決できません: System.Web.Mvc、Version=3.0.0.0、Culture=neutral、PublicKeyToken=31bf3856ad364e35。
私は apache-maven-3.0.2 と sonar-3.2 を使用しています。誰でもこれを手伝ってもらえますか?
これは完全な POM.XML ファイルです
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>Test</groupId>
<artifactId>Sonar.For.NET.Test</artifactId>
<version>1.0</version>
<name>Testing </name>
<packaging>netpack</packaging>
<properties>
<visual.studio.solution>TestProjectsForSonarBuild.sln</visual.studio.solution>
<visual.test.project.pattern>*.Tests;*Test</visual.test.project.pattern>
<dotnet.tool.version>4.0</dotnet.tool.version>
<sonar.language>cs</sonar.language>
</properties>
<dependencies>
<dependency>
<groupId>artifact_group_id</groupId>
<artifactId>System.WEb.MVC</artifactId>
<version>4.0.30319</version>
<type>library</type>
<scope>system</scope>
<systemPath>C:\DOTNET\DLLS\System.Web.Mvc.dll</systemPath>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.sonar-plugins.dotnet</groupId>
<artifactId>maven-dotnet-plugin</artifactId>
<version>0.6</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<configuration>
<toolVersion>3.5</toolVersion>
<buildConfigurations>Debug</buildConfigurations>
<rebuild>true</rebuild>
<language>cs</language>
</configuration>
</plugin>
</plugins>
</build>
</project>
御時間ありがとうございます。