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:
- checked the access.log, server.log and event logs
- upgraded the existing server to v5.1.2 (clean install using the guide)
- upgraded the sonar-csharp-plugin to v4.1
- right-clicked all .jar files on the server and ensured they are unblocked
- tried the runner directly on the server
- (ongoing) tried debugging the source code (happening somewhere in the pre-process step:
success
comes back astrue
, but the error code is 1) - disabled UAC on the server an rebooted
- re-installed JRE on both server and client, ensure
JAVA_HOME
in bothPATH
and registry are set correctly
Any 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.
This is a tricky one! Looking at the code, I see only one path that can yield this output:
GenerateFxCopRuleset()
call for C# threw aWebException
, leading to the call ofUtilities.HandleHostUrlWebException()
- which has to returntrue
for the exception to be silently swallowed - see Utilities.cs#L153true
without logging any message is if aHttpStatusCode.NotFound
was received - see Utilities.cs#L158FetchArgumentsAndRulesets()
, which returnsfalse
, then goes back toExecute()
which returnsfalse
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