Usage of Maven Dotnet Plugin

In order to use the plugin, you must install the following prerequisite application on the machine and define the associated properties in the maven settings.xml file, either in the $M2_HOME/conf/ directory (recommended as it is mostly machine-specific) or in $HOME/.m2 directory.

Installation

To use the different goals, you must first install the .Net framework if it is not bundled in your system.

Prerequisite applications

The following application are use by the different goals:

Application PropertyUsageSupported VersionDownload site
MSBuilddotnet.3.5.sdk.dir.Net sdk install dir2.0, 3.5http://msdn.microsoft.com/en-us/netframework/aa569263.aspx
Galliogallio.directory.Net test runner3.1 Update 2 +http://www.gallio.org
PartCoverpartcover.directory.Net code coverage2.2, 2.3 and 4.0http://github.com/sawilde/partcover.net4
NCoveruseNCover (boolean).Net code coverage3.0http://www.ncover.com
Source Monitorsourcemoniter.directoryC# code metrics2.5 +http://www.geardownload.com/development/sourcemonitor-download.html
Fx Copfxcop.directory.Net code quality reports1.36 +http://www.infoq.com/news/2010/06/FXCop-10
Style Cop *stylecop.directoryC# code style report4.3+http://code.msdn.microsoft.com/sourceanalysis
Mono Gendarme **gendarme.directory.Net code quality reports2.10+http://www.mono-project.com/Gendarme

* Style Cop 4.4 is bundle with the maven dotnet plugin since version 0.3 . Thus installation of Style Cop is not mandatory.

** Gendarme 2.10 is bundle with the maven dotnet plugin. Thus installation of Gendarme is not mandatory.

Coverage

There is a bug in the coverage reports generated by PartCover 2.3 and 4.0 (prior to version 4.0.11013), in which the source files that have no line covered are excluded, and thus, the coverage percentage only corresponds to the coverage of ... the covered files :-(

NCover is a commercial alternative to PartCover. After having installed NCover3, you can activate it for sonar by setting property useNCover to true. NCover3 has the advantages of not suffering from the bug described before and working perfectly on a 64bit OS.

Indeed, if you are using a 64bit OS with PartCover, you need to play a little bit with tool CorFlags.exe as it is described here : http://stackoverflow.com/questions/256287/how-do-i-run-partcover-in-x64-windows.

PartCover.exe and Gallio.Echo.exe need to be modified using CorFlags.

Project configuration

To use the plugin, you just need to add a pom.xml in the root folder of the .Net solution, in the directory where the '.sln' file is located as described in this example.

You will also need to provide a path to the installation of .Net, and other tools if required for the different generated reports as described here.

An example of file tree for a solution

Here is a file tree of a standard .Net solution on which Maven is activated:

  + my-solution.sln 
  |
  + pom.xml
  |
  + example-project
  |     |
  |     + example-project.csproj
  |     |
  |     + namespaces...
  |
  + other-project
        |
        + other-project.csproj