Reputation: 581
I'm trying out SonarQube using the new MSBuild SonarQube Runner v1.0. If I install a fresh SonarQube server locally, the following command works fine, and I can build my solution directly afterward, call the 'end' command, and have the results published in SonarQube:
MSBuild.SonarQube.Runner.exe begin /key:TestKey /name:TestName /version:1.0.0.0
However, if I run this against an existing SonarQube server that exists on the internal network, it always returns with exit code 1:
15:32:40 Creating config and output folders...
15:32:40 Creating directory: c:\Test\MSBuild.SonarQube.Runner-1.0.itsonar\.sonarqube\conf
15:32:40 Creating directory: c:\Test\MSBuild.SonarQube.Runner-1.0.itsonar\.sonarqube\out
15:32:41 Generating the FxCop ruleset: c:\Test\MSBuild.SonarQube.Runner-1.0.itsonar\.sonarqube\conf\SonarQubeFxCop-cs.ruleset
Process returned exit code 1
It seems to download a lot of the dependencies into /.sonarqube, so communication with the server isn't an issue
Things I've tried:
success
comes back as true
, but the error code is 1)JAVA_HOME
in both PATH
and registry are set correctlyAny help or pointers greatly accepted. I've been stuck on this for 2 days and can't think of anything else to try except continue trawling through source code. Thank you.
Upvotes: 4
Views: 692
Reputation: 3011
This is a tricky one! Looking at the code, I see only one path that can yield this output:
GenerateFxCopRuleset()
call for C# threw a WebException
, leading to the call of Utilities.HandleHostUrlWebException()
- which has to return true
for the exception to be silently swallowed - see Utilities.cs#L153true
without logging any message is if a HttpStatusCode.NotFound
was received - see Utilities.cs#L158FetchArgumentsAndRulesets()
, which returns false
, then goes back to Execute()
which returns false
as well - see TeamBuildPreProcessor.cs#L106So, at some point, some SonarQube web service required for the C# FxCop ruleset generation is return a HTTP 404 error.
Could you monitor your network traffic and listen for the failing HTTP call? [I will keep on updating this answer afterwards]
EDIT: Indeed the error is caused by the quality profile name containing special characters. Such characters are currently badly URL-escaped, which leads to a 404.
I've created the following ticket to fix this issue in the upcoming release: http://jira.sonarsource.com/browse/SONARMSBRU-125
Upvotes: 4