We are working on a PoC to have SonarQube implemented for our project but while installing we are facing issues.
Steps Performed:
- Installed latest version of Java 11 which supports the latest version of SonarQube
- Ran the batch files present in bin folder of the downloaded files
- Received the message in the command prompt that SonarQube is up
- But when we try to start the service “SonarQube” it fails with popup “service started but stopped”.
Can anyone help how to resolve it and get started with SonarQube.
Thanks,
Harshal Kolhe
Hi @harshalkolhe ,
welcome to the community 
have you checked the content of the Log Files ? Maybe there are some more information why the service stopped so quickly
Hello Tobias,
Thank you…
If you can help me with the path where I can find the logs, I will get it checked.
Thanks,
Harshal
Hi @harshalkolhe ,
there is a folder called logs
within your sonarqube installation
Hi Tobias,
I have the local URL for SonarQube working now and logged in with admin credentials.
Created a new project and generated a token post which it is asking to download SonarScanner for MSBuild but after following all the steps mentioned in the below path:
https://sonarcloud.io/documentation/analysis/scan/sonarscanner-for-msbuild/
and setting the environment variable getting this error while installing the scanner -
“No executable found matching command “dotnet-tool””
Could you help on this if I am missing something?
Hi @harshalkolhe ,
did you add the dotnet-tool
binary to your PATH variable as described here ?
Hello Tobias,
Thanks for the help!
I set the Path parameter of the installation directory in the environment variables but it did not pick the SonarScanner,MSBuild.exe file so I gave as below:
C:\SonarQubeScanner\MSBuildScanner\SonarScanner.MSBuild.exe begin /k:“FirstTestProject” /d:sonar.host.url=“http://localhost:9000” /d:sonar.login=“974bb767a397d9b40cce76b6d4572fe3f0205e5f”
I executed the above command from the root of project where .sln file is available and I got results as pre-processing successful and can also find some .sonarqube files created in the root.
Could you help us with next step for code analysis.
Thanks,
Harshal
Hi @harshalkolhe ,
if the scanner was executed successfully, you should be able to see an analysis in sonarqube now. the next logical step would be to integrate sonarqube to your development process, to continuously scan your code and get feedback on every pull request how the code quality changes or if a quality gate is passed.
philosophical there is a recent blog post by @ganncamp how to approach this
Hello @Tobias_Trabelsi,
Thank you for the details but I guess it is failing to scan the copy, Please find the below steps which I am executing to run the scanner from source root
Step1:
The first begin part works as shows below:
E:\TCS\Harshal\RMDB_Phase_2\02_Jul_2018\ITRequests>C:\SonarQubeScanner\MSBuildSc
anner\SonarScanner.MSBuild.exe begin /k:“FirstTestProject” /d:sonar.host.url=“ht
tp://localhost:9000” /d:sonar.login=“974bb767a397d9b40cce76b6d4572fe3f0205e5f”
SonarScanner for MSBuild 4.10
Using the .NET Framework version of the Scanner for MSBuild
Pre-processing started.
Preparing working directories…
18:00:09.257 Updating build integration targets…
18:00:09.293 Fetching analysis configuration settings…
18:00:09.954 Provisioning analyzer assemblies for cs…
18:00:09.957 Installing required Roslyn analyzers…
18:00:10.672 Provisioning analyzer assemblies for vbnet…
18:00:10.673 Installing required Roslyn analyzers…
18:00:10.724 Pre-processing succeeded.
Step 2: (This Part is failing) *********
E:\TCS\Harshal\RMDB_Phase_2\02_Jul_2018\ITRequests>MsBuild.exe /t:Rebuild
‘MsBuild.exe’ is not recognized as an internal or external command,
operable program or batch file.
Step 3: It fails due to Rebuild is not working:
E:\TCS\Harshal\RMDB_Phase_2\02_Jul_2018\ITRequests>C:\SonarQubeScanner\MSBuildSc
anner\SonarScanner.MSBuild.exe end /d:sonar.login=“974bb767a397d9b40cce76b6d4572
fe3f0205e5f”
SonarScanner for MSBuild 4.10
Using the .NET Framework version of the Scanner for MSBuild
Post-processing started.
The SonarQube MSBuild integration failed: SonarQube was unable to collect the re
quired information about your projects.
Possible causes:
- The project has not been built - the project must be built in between the b
egin and end steps
- An unsupported version of MSBuild has been used to build the project. Curre
ntly MSBuild 14.0.25420.1 and higher are supported.
- The begin, build and end steps have not all been launched from the same fol
der
- None of the analyzed projects have a valid ProjectGuid and you have not use
d a solution (.sln)
Generation of the sonar-properties file failed. Unable to complete SonarQube ana
lysis.
18:00:37.005 Post-processing failed. Exit code: 1
Could you help how to get the code rebuilt with MSBuild command, this executable is from the scanner or Visual Studio?
Hi @harshalkolhe ,
MsBuild.exe is not recognized as an internal or external command
looks like you are facing the the problem as before. please make sure that you have the microsoft build tools installed on your system and that the binaries are available in your $PATH