and this is the log: ``` *00:00:00.901* Injecting SonarQube environment variables using the configuration: SonarQube2 [Pipeline] { <http://localhost:8080/job/Boston/37/console#> [Pipeline] bat <http://localhost:8080/job/Boston/37/console#> *00:00:01.175* *00:00:01.175* C:\Users\anton\.jenkins\workspace\Boston>C:\Users\anton\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\Sonnar_scanner\sonar-scanner-4.4.0.2170\bin\sonar-scanner.bat -D sonar.projectKey=Test -D sonar.projectName=Test -D sonar.sources=. -D sonar.scm.disabled=true -D sonar.language=c++ -D sonar.sourceEncoding=UTF-8 *00:00:01.175* INFO: Scanner configuration file: C:\Users\anton\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\Sonnar_scanner\sonar-scanner-4.4.0.2170\bin\..\conf\sonar-scanner.properties *00:00:01.175* INFO: Project root configuration file: NONE *00:00:01.175* INFO: SonarScanner 4.4.0.2170 *00:00:01.175* INFO: Java 1.8.0_261 Oracle Corporation (64-bit) *00:00:01.175* INFO: Windows 10 10.0 amd64 *00:00:02.090* INFO: User cache: C:\WINDOWS\system32\config\systemprofile\.sonar\cache *00:00:02.090* INFO: Scanner configuration file: C:\Users\anton\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\Sonnar_scanner\sonar-scanner-4.4.0.2170\bin\..\conf\sonar-scanner.properties *00:00:02.090* INFO: Project root configuration file: NONE *00:00:02.090* INFO: Analyzing on SonarQube server 8.5.1 *00:00:02.090* INFO: Default locale: "es_ES", source code encoding: "UTF-8" *00:00:02.343* WARN: SonarScanner will require Java 11 to run starting in SonarQube 8.x *00:00:02.343* INFO: Load global settings *00:00:02.343* INFO: Load global settings (done) | time=42ms *00:00:02.343* INFO: Server id: BF41A1F2-AXWnoupqHjnRwWgEnmvK *00:00:02.343* INFO: User cache: C:\WINDOWS\system32\config\systemprofile\.sonar\cache *00:00:02.343* INFO: Load/download plugins *00:00:02.343* INFO: Load plugins index *00:00:02.343* INFO: Load plugins index (done) | time=26ms *00:00:02.594* INFO: Load/download plugins (done) | time=50ms *00:00:02.846* INFO: Process project properties *00:00:02.846* INFO: Process project properties (done) | time=7ms *00:00:02.846* INFO: Execute project builders *00:00:02.846* INFO: Execute project builders (done) | time=1ms *00:00:02.846* INFO: Project key: Test *00:00:02.846* INFO: Base dir: C:\Users\anton\.jenkins\workspace\Boston *00:00:02.846* INFO: Working dir: C:\Users\anton\.jenkins\workspace\Boston\.scannerwork *00:00:03.097* INFO: Load project settings for component key: 'Test' *00:00:03.097* INFO: Load project settings for component key: 'Test' (done) | time=9ms *00:00:03.097* INFO: Load quality profiles *00:00:03.097* INFO: Load quality profiles (done) | time=38ms *00:00:03.097* INFO: Auto-configuring with CI 'Jenkins' *00:00:03.097* INFO: Load active rules *00:00:04.011* INFO: Load active rules (done) | time=981ms *00:00:04.263* INFO: Indexing files... *00:00:04.263* INFO: Project configuration: *00:00:04.263* INFO: 0 files indexed *00:00:04.263* INFO: ------------- Run sensors on module Test *00:00:04.263* INFO: Load metrics repository *00:00:04.263* INFO: Load metrics repository (done) | time=13ms *00:00:05.178* INFO: Sensor CSS Rules [cssfamily] *00:00:05.178* INFO: No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped. *00:00:05.178* INFO: Sensor CSS Rules [cssfamily] (done) | time=1ms *00:00:05.178* INFO: Sensor JaCoCo XML Report Importer [jacoco] *00:00:05.178* INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml *00:00:05.178* INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer *00:00:05.178* INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=3ms *00:00:05.178* INFO: Sensor C# Properties [csharp] *00:00:05.178* INFO: Sensor C# Properties [csharp] (done) | time=2ms *00:00:05.178* INFO: Sensor JavaXmlSensor [java] *00:00:05.178* INFO: Sensor JavaXmlSensor [java] (done) | time=1ms *00:00:05.178* INFO: Sensor VB.NET Properties [vbnet] *00:00:05.178* INFO: Sensor VB.NET Properties [vbnet] (done) | time=1ms *00:00:05.178* INFO: ------------- Run sensors on project *00:00:05.178* INFO: Sensor Zero Coverage Sensor *00:00:05.178* INFO: Sensor Zero Coverage Sensor (done) | time=0ms *00:00:05.178* INFO: SCM Publisher is disabled *00:00:05.178* INFO: CPD Executor Calculating CPD for 0 files *00:00:05.178* INFO: CPD Executor CPD calculation finished (done) | time=0ms *00:00:05.178* INFO: Analysis report generated in 58ms, dir size=82 KB *00:00:05.178* INFO: Analysis report compressed in 14ms, zip size=10 KB *00:00:05.178* INFO: Analysis report uploaded in 25ms *00:00:05.178* INFO: ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard?id=Test *00:00:05.178* INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report *00:00:05.178* INFO: More about the report processing at http://localhost:9000/api/ce/task?id=AXW4OGqF0bymGINu8Ui8 *00:00:05.178* INFO: Executing post-job 'Final report' *00:00:05.178* INFO: Turn debug info on to get more details (sonar-scanner -X -Dsonar.verbose=true ...). *00:00:05.178* INFO: Analysis total time: 2.676 s *00:00:05.178* INFO: ------------------------------------------------------------------------ *00:00:05.178* INFO: EXECUTION SUCCESS *00:00:05.178* INFO: ------------------------------------------------------------------------ *00:00:05.178* INFO: Total time: 4.015s *00:00:05.178* INFO: Final Memory: 24M/545M *00:00:05.178* INFO: ------------------------------------------------------------------------ ``` But then on the SonarQube UI it says: "The main branch has no lines of code." even though on activity I can see the task has been executed each time I run the pipeline El miércoles, 11 de noviembre de 2020 a las 22:09:21 UTC+1, jesus fernandez escribió:
> Thanks Geofrroy for your answer, > > I had posted the question in the sonarsource community with no answer > already. I am using the free version with the C++ plugin which works fine > in many tutorials and videos you can find online. This is my pipeline: > ``` > pipeline > { > agent any > > options { timestamps () } > stages{ > > stage('Build'){ > steps{ > retry(2){ > script { > bat """ > "C:\\Program Files (x86)\\Microsoft Visual > Studio\\2017\\Community\\MSBuild\\15.0\\Bin\\MSBuild.exe" > "C:\\Users\\anton\\source\\repos\\WindowsProject1\\WindowsProject1.sln" > """ > } > } > } > } > > stage('SonarQube analysis') { > steps{ > script{ > def scannerHome = tool 'Sonnar_scanner' > withSonarQubeEnv('SonarQube2') { > bat """ > > ${scannerHome}\\sonar-scanner-4.4.0.2170\\bin\\sonar-scanner.bat -D > sonar.projectKey=Test -D sonar.projectName=Test -D sonar.sources=. -D > sonar.scm.disabled=true -D sonar.language=c++ -D sonar.sourceEncoding=UTF-8 > """ > } > } > } > } > } > } > > ``` > > Thanks! > > El miércoles, 11 de noviembre de 2020 a las 20:45:45 UTC+1, > geoffroy...@gmail.com escribió: > >> Hello >> you should probably ask here: https://community.sonarsource.com/ >> Are you using the paid version of SonarQube, to get C/C++ analysis >> feature? >> Also, from experience, before running any new tool analysis from Jenkins, >> it is better to first run (and debug) it locally. Sonar scanner local >> analysis is quite easy to execute, it could help you troubleshoot your >> issue. >> Last, please post your pipeline code so we can check you are properly >> running the analysis from the source folder actually containing the sonar >> properties file >> Regards >> >> On Wednesday, 11 November 2020 at 17:29:54 UTC+1 jesusfern...@gmail.com >> wrote: >> >>> Hi David, >>> >>> Thanks for your answer but I get the same result when adding the >>> parameters with -D I get the "*00:00:01.529* *INFO: Project root >>> configuration file: NONE" *message at the beginning of the log. I have >>> tried to create the helloworld simplest c++ project just to test, but I get >>> the same error, what am I missing? >>> El martes, 10 de noviembre de 2020 a las 20:41:32 UTC+1, >>> davidmic...@gmail.com escribió: >>> >>>> I believe that the mistake that most people make with running the >>>> sonarqube scan from a CI build is TRYING to define a sonarqube properties >>>> file. It's best to simply provide all of the required options on the >>>> sonar-scanner command line, using "-D". >>>> >>>> On Tue, Nov 10, 2020 at 3:44 AM jesus fernandez <jesusfern...@gmail.com> >>>> wrote: >>>> >>>>> I am trying to learn the basics of sonarqube, I have set it up on my >>>>> jenkins pipeline (which uses MSBuild to compile the project) and the set >>>>> a >>>>> step to execute SonarQube but after reading and watching a few tutorials >>>>> and the documentation itself I think I got a bit lost as when my pipeline >>>>> finishes executing I go to my SonarQube server and I my project says >>>>> ```The >>>>> main branch has no lines of code.```. I get the following log when >>>>> running >>>>> the sonarqube step on my jenkins: >>>>> ``` >>>>> 00:10:43.369 Injecting SonarQube environment variables using the >>>>> configuration: SonarQube >>>>> [Pipeline] { >>>>> [Pipeline] bat >>>>> 00:10:43.653 >>>>> 00:10:43.653 >>>>> C:\Users\anton\.jenkins\workspace\Boston>C:\Users\anton\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\Sonnar_scanner\sonar-scanner-4.4.0.2170\bin\sonar-scanner.bat >>>>> >>>>> >>>>> 00:10:43.653 INFO: Scanner configuration file: >>>>> C:\Users\anton\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\Sonnar_scanner\sonar-scanner-4.4.0.2170\bin\..\conf\sonar-scanner.properties >>>>> 00:10:43.653 INFO: Project root configuration file: NONE >>>>> 00:10:43.653 INFO: SonarScanner 4.4.0.2170 >>>>> 00:10:43.653 INFO: Java 1.8.0_261 Oracle Corporation (64-bit) >>>>> 00:10:43.653 INFO: Windows 10 10.0 amd64 >>>>> 00:10:44.230 INFO: User cache: >>>>> C:\WINDOWS\system32\config\systemprofile\.sonar\cache >>>>> 00:10:44.230 INFO: Scanner configuration file: >>>>> C:\Users\anton\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\Sonnar_scanner\sonar-scanner-4.4.0.2170\bin\..\conf\sonar-scanner.properties >>>>> 00:10:44.230 INFO: Project root configuration file: NONE >>>>> 00:10:44.230 INFO: Analyzing on SonarQube server 8.5.1 >>>>> 00:10:44.230 INFO: Default locale: "es_ES", source code encoding: >>>>> "UTF-8" >>>>> 00:10:44.783 WARN: SonarScanner will require Java 11 to run starting >>>>> in SonarQube 8.x >>>>> 00:10:44.784 INFO: Load global settings >>>>> 00:10:44.784 INFO: Load global settings (done) | time=40ms >>>>> 00:10:44.784 INFO: Server id: BF41A1F2-AXWnoupqHjnRwWgEnmvK >>>>> 00:10:44.784 INFO: User cache: >>>>> C:\WINDOWS\system32\config\systemprofile\.sonar\cache >>>>> 00:10:44.784 INFO: Load/download plugins >>>>> 00:10:44.784 INFO: Load plugins index >>>>> 00:10:44.784 INFO: Load plugins index (done) | time=26ms >>>>> 00:10:44.784 INFO: Load/download plugins (done) | time=48ms >>>>> 00:10:45.037 INFO: Process project properties >>>>> 00:10:45.037 INFO: Process project properties (done) | time=6ms >>>>> 00:10:45.037 INFO: Execute project builders >>>>> 00:10:45.037 INFO: Execute project builders (done) | time=1ms >>>>> 00:10:45.037 INFO: Project key: Boston >>>>> 00:10:45.037 INFO: Base dir: C:\Users\anton\.jenkins\workspace\Boston >>>>> 00:10:45.037 INFO: Working dir: >>>>> C:\Users\anton\.jenkins\workspace\Boston\.scannerwork >>>>> 00:10:45.301 INFO: Load project settings for component key: 'Boston' >>>>> 00:10:45.301 INFO: Load project settings for component key: 'Boston' >>>>> (done) | time=10ms >>>>> 00:10:45.301 INFO: Load quality profiles >>>>> 00:10:45.301 INFO: Load quality profiles (done) | time=27ms >>>>> 00:10:45.301 INFO: Auto-configuring with CI 'Jenkins' >>>>> 00:10:45.301 INFO: Load active rules >>>>> 00:10:46.241 INFO: Load active rules (done) | time=787ms >>>>> 00:10:46.241 INFO: Indexing files... >>>>> 00:10:46.241 INFO: Project configuration: >>>>> 00:10:46.241 INFO: 0 files indexed >>>>> 00:10:46.241 INFO: ------------- Run sensors on module Boston >>>>> 00:10:46.241 INFO: Load metrics repository >>>>> 00:10:46.241 INFO: Load metrics repository (done) | time=12ms >>>>> 00:10:46.807 INFO: Sensor CSS Rules [cssfamily] >>>>> 00:10:46.807 INFO: No CSS, PHP, HTML or VueJS files are found in the >>>>> project. CSS analysis is skipped. >>>>> 00:10:46.807 INFO: Sensor CSS Rules [cssfamily] (done) | time=1ms >>>>> 00:10:46.807 INFO: Sensor JaCoCo XML Report Importer [jacoco] >>>>> 00:10:46.807 INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not >>>>> defined. Using default locations: >>>>> target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml >>>>> 00:10:46.807 INFO: No report imported, no coverage information will >>>>> be imported by JaCoCo XML Report Importer >>>>> 00:10:46.807 INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) >>>>> | time=1ms >>>>> 00:10:46.807 INFO: Sensor C# Properties [csharp] >>>>> 00:10:46.807 INFO: Sensor C# Properties [csharp] (done) | time=1ms >>>>> 00:10:46.807 INFO: Sensor JavaXmlSensor [java] >>>>> 00:10:46.807 INFO: Sensor JavaXmlSensor [java] (done) | time=0ms >>>>> 00:10:46.807 INFO: Sensor VB.NET Properties [vbnet] >>>>> 00:10:46.807 INFO: Sensor VB.NET Properties [vbnet] (done) | time=0ms >>>>> 00:10:46.807 INFO: ------------- Run sensors on project >>>>> 00:10:46.807 INFO: Sensor Zero Coverage Sensor >>>>> 00:10:46.807 INFO: Sensor Zero Coverage Sensor (done) | time=0ms >>>>> 00:10:46.807 INFO: SCM Publisher is disabled >>>>> 00:10:46.807 INFO: CPD Executor Calculating CPD for 0 files >>>>> 00:10:46.807 INFO: CPD Executor CPD calculation finished (done) | >>>>> time=0ms >>>>> 00:10:46.807 INFO: Analysis report generated in 48ms, dir size=82 KB >>>>> 00:10:46.807 INFO: Analysis report compressed in 10ms, zip size=10 KB >>>>> 00:10:47.060 INFO: Analysis report uploaded in 26ms >>>>> 00:10:47.060 INFO: ANALYSIS SUCCESSFUL, you can browse >>>>> http://localhost:9000/dashboard?id=Boston >>>>> 00:10:47.060 INFO: Note that you will be able to access the updated >>>>> dashboard once the server has processed the submitted analysis report >>>>> 00:10:47.060 INFO: More about the report processing at >>>>> http://localhost:9000/api/ce/task?id=AXWt8eSC9o0F9NdVJGJP >>>>> 00:10:47.060 INFO: Executing post-job 'Final report' >>>>> 00:10:47.060 INFO: Turn debug info on to get more details >>>>> (sonar-scanner -X -Dsonar.verbose=true ...). >>>>> 00:10:47.060 INFO: Analysis total time: 2.118 s >>>>> 00:10:47.060 INFO: >>>>> ------------------------------------------------------------------------ >>>>> 00:10:47.060 INFO: EXECUTION SUCCESS >>>>> 00:10:47.060 INFO: >>>>> ------------------------------------------------------------------------ >>>>> 00:10:47.060 INFO: Total time: 3.274s >>>>> 00:10:47.060 INFO: Final Memory: 21M/549M >>>>> 00:10:47.060 INFO: >>>>> ------------------------------------------------------------------------ >>>>> [Pipeline] } >>>>> [Pipeline] // withSonarQubeEnv >>>>> [Pipeline] } >>>>> [Pipeline] // script >>>>> [Pipeline] } >>>>> [Pipeline] // stage >>>>> [Pipeline] } >>>>> [Pipeline] // timestamps >>>>> [Pipeline] } >>>>> [Pipeline] // node >>>>> [Pipeline] End of Pipeline >>>>> Finished: SUCCESS >>>>> ``` >>>>> and I think the main issue is the line where it says ```Project root >>>>> configuration file: NONE``` I have created a sonar-project.properties >>>>> file >>>>> in the root folder of my project and it has the following configuration: >>>>> ``` >>>>> sonar.projectKey=Boston >>>>> sonar.projectName=Boston >>>>> sonar.dotnet.visualStudio.solution=Age3DE.sln >>>>> sonar.scm.disabled=true >>>>> >>>>> sonar.sources=./Source >>>>> sonar.language=c++ >>>>> sonar.sourceEncoding=UTF-8 >>>>> >>>>> ``` >>>>> But yet I cannot make it work. I do not know what I am doing wrong, >>>>> should the sonar-project.properties be set anywhere else? >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Jenkins Users" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to jenkinsci-use...@googlegroups.com. >>>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/jenkinsci-users/f3de3b3c-9ed6-4d8e-b2cb-875ee40db8edn%40googlegroups.com >>>>> >>>>> <https://groups.google.com/d/msgid/jenkinsci-users/f3de3b3c-9ed6-4d8e-b2cb-875ee40db8edn%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> >>>> -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/d14cfeb9-fea0-4434-8034-f10fea7b927fn%40googlegroups.com.