using the dotnet-sonarscanner version 4.7.1 through the command line
trying to get the sonar scanner running from the command line at the moment with just msbuild.exe solution.sln /rebuild it’s currently failing on the post-processing step and i can’t seem to get beyond that
I thought maybe having spaces in my java path was causing the problem so I tried updating my path to a location that didn’t have any spaces in it but no luck.
I also tried using dotnet sonar scanner and msbuild sonar scanner. both with the same result
These are the steps i’m executing:
dotnet-sonarscanner begin /k:"key" /d:sonar.host.url="https://my_company_sonarqube.com" /d:sonar.login="token" /d:sonar.verbose=true
MSBuild.exe solution.sln /t:Rebuild /p:Platform="Any CPU"
dotnet-sonarscanner end /d:sonar.login="token"
Everything seems to work fine until i get to the post-processing step:
Executing file C:\Users\userid\.dotnet\tools\.store\dotnet-sonarscanner\4.7.1\dotnet-sonarscanner\4.7.1\tools\netcoreapp2.1\any\sonar-scanner-4.1.0.1829\bin\sonar-scanner.bat
Args: -Dsonar.scanAllFiles=true -Dproject.settings=C:\Users\userid\Documents\project_path\.sonarqube\out\sonar-project.properties --embedded --debug <sensitive data removed>
Working directory: C:\Users\userid\Documents\project_path
Timeout (ms):-1
Process id: 38116
Error: Could not find or load main class
Process returned exit code 1
The SonarQube Scanner did not complete successfully
19:53:44.155 Post-processing failed. Exit code: 1
I turned on /d:sonar.verbose=true in the begin statement and piped everything to a file. I have quite a bit of output from that. Is there another place I can look for debugging information?
java -version
java version "1.8.0_221"
Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)
Can you try to re-issue the sonar-scanner-4.1.0.1829\bin\sonar-scanner.bat commandline directly with the arguments quoted just below to see if you get any extra log ? Seems weird that we don’t have the main class name that fails to load.
Can you very that the JAR \lib\sonar-scanner-cli-4.1.0.1829.jar is not altered? Check its size, and if you can unzip it. You can also compute its hash (md5 or sha1) so that we could compare.
In the past I remember some very aggressive anti-virus software having corrupted our files.
Can you also give us the output of: C:\Program Files (x86)\Common Files\Oracle\Java\javapath\java.exe -version
Java 8 is fine (sorry, I missed your previous post mentioning it), no need to upgrade. The sha1 looks good as well.
Can you try to run the command directly: "C:\Program Files (x86)\Common Files\Oracle\Java\javapath\java.exe" -Djava.awt.headless=true -Xdebug "" -cp "C:\Users\userid\.dotnet\tools\.store\dotnet-sonarscanner\4.7.1\dotnet-sonarscanner\4.7.1\tools\netcoreapp2.1\any\sonar-scanner-4.1.0.1829\bin\..\lib\sonar-scanner-cli-4.1.0.1829.jar" "-Dscanner.home=C:\Users\userid\.dotnet\tools\.store\dotnet-sonarscanner\4.7.1\dotnet-sonarscanner\4.7.1\tools\netcoreapp2.1\any\sonar-scanner-4.1.0.1829\bin\.." "-Dproject.home=C:\Users\userid\Documents\project_path" org.sonarsource.scanner.cli.Main -Dsonar.scanAllFiles=true -Dproject.settings=C:\Users\userid\Documents\project_path\.sonarqube\out\sonar-project.properties --embedded --debug
There is maybe an escaping problem, either because of a space, or maybe because of another character.
ok so i’m not sure why i was getting the main class error, but it looks like my problem was not having my ssl certificates for the sonarqube server. Starting over and setting SONAR_SCANNER_OPTS seemed to do the trick.
set SONAR_SCANNER_OPTS = "-Djavax.net.ssl.trustStore="C:\path\to\trustStore"