Reputation: 185
good day today i was setup sonarqube with ms build runner and mercurial scm provider i have next structure of repository (schematic):
<ROOT>
-.hg
-src
----prj.infrastructure
----prj.domain
----prj.application
----prj.sln
and i used next command for run analysis:
"%env.SonarMsBuildRunner%\MSBuild.SonarQube.Runner" begin /n:prj /k:prj /v:1.0
"%env.MsBuildLocation%\msbuild" src\prj.sln /p:Configuration=Debug
"%env.SonarMsBuildRunner%\msbuild.sonarqube.runner" end
all analysis are work well, but scm not work (i see message like " Missing blame information for the following files:")
when i see generated sonar-project.properties i saw that problem is in projectBaseDir - it generates for each project in solution separately
i try to specify in command line like /d:sonar.projectBaseDir=... but no changes - it fully ignored
so my question is - can i use ms build runner and scm provider together with my repository structure?
UPDATE 1 i awas added verbose flag to my script.. now i run analysis with next command:
MSBuild.SonarQube.Runner begin /n:projectName /k:projectKey /v:1.0 /d:sonar.scm.enabled=true /d:sonar.scm.provider=hg /d:sonar.projectBaseDir=d:\work\project1 /d:sonar.verbose=true
msbuild project1\src\solution.sln /p:Configuration=Debug
msbuild.sonarqube.runner end
in log i can see this messages:
[14:18:20] : [Step 4/4] 14:18:20.403 DEBUG: Working directory: D:\work\project1\src\
[14:18:20] : [Step 4/4] 14:18:20.416 DEBUG: Executing: hg blame -w -v --user --date --changeset API/AssignmentsController.cs
[14:18:20] : [Step 4/4] 14:18:20.423 DEBUG: Executing: hg blame -w -v --user --date --changeset API/Commands/ImportCommand.cs
[14:18:20] : [Step 4/4] 14:18:20.424 DEBUG: Executing: hg blame -w -v --user --date --changeset API/Dto/Assignment.cs
[14:18:20] : [Step 4/4] 14:18:20.600 DEBUG: The mercurial blame command [hg blame -w -v --user --date --changeset API/AssignmentsController.cs] failed: abort: no repository found in 'D:\work\project1\src\' (.hg not found)!
[14:18:20] : [Step 4/4]
and this is right - in folder d:\work\project1\src no .hg directory, because it's place in d:\work\project1
UPDATE2
ok, finally i find than i my mistake... on build machine folder .hg missed by some reasons...
Upvotes: 0
Views: 453
Reputation: 5326
This is a limitation of the SonarQube Mercurial Plugin. It currently expects to find the .hg folder precisely in the basedir. Other plugins like SVN where updated to look recursively in parent folders.
We are no more actively developing the Mercurial plugin, but feel free to submit a pull request to fix the issue.
As a workaround, you can force the SCM using /d:sonar.scm.provider=hg
in the begin step.
Upvotes: 2