Jenkins 当试图在詹金斯管道上执行Sonarqube时,我得到一个;项目根配置文件:无";日志消息

Jenkins 当试图在詹金斯管道上执行Sonarqube时,我得到一个;项目根配置文件:无";日志消息,jenkins,sonarqube,jenkins-pipeline,sonarqube-scan,Jenkins,Sonarqube,Jenkins Pipeline,Sonarqube Scan,我正在尝试学习sonarqube的基础知识,我已经在jenkins管道上设置了它(它使用MSBuild编译项目)设置了执行SonarQube的步骤,但是在阅读和观看了一些教程和文档之后,我想我有点迷路了,因为当我的管道完成执行时,我转到SonarQube服务器,我的项目说,主分支没有代码行。。在我的jenkins上运行sonarqube步骤时,我得到以下日志: 00:10:43.369 Injecting SonarQube environment variables using the co

我正在尝试学习sonarqube的基础知识,我已经在jenkins管道上设置了它(它使用MSBuild编译项目)设置了执行SonarQube的步骤,但是在阅读和观看了一些教程和文档之后,我想我有点迷路了,因为当我的管道完成执行时,我转到SonarQube服务器,我的项目说,
主分支没有代码行。
。在我的jenkins上运行sonarqube步骤时,我得到以下日志:

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

我认为主要的问题是,在这一行中,它表示
项目根配置文件:无
我已经在项目的根文件夹中创建了一个sonar-Project.properties文件,并且它具有以下配置:

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


但我不能让它工作。我不知道我做错了什么,sonar-project.properties是否应该设置在其他地方?

如果源文件存在于Sources目录中,那么您的sonar.Sources应该是这样的

sonar.sources=**/sources/*


sonar.sources=sources/*

谢谢您的回答,我已经按照您告诉我的那样对其进行了更改,但仍然收到相同的错误:
项目根配置文件:无
我已将sonar-Project.properties放在我的项目的父文件夹中,它是否要放在其他地方?它应该放在主文件夹的源文件夹中吗?sonar-project.properties文件应该只放在根文件夹中。你能告诉我,你在声纳界面上看到的错误是什么吗??另外,你能试着给出
sonar.sources=。
我试过
sonar.sources=。
我得到了同样的结果,由于prject.sln文件位于源文件夹中,我尝试将该文件设置在主文件夹中,也设置在源文件夹中,源文件夹是主文件夹的直接子文件夹,但无法工作如果我在SonarQube UI上转到我的项目,我会看到该项目没有代码行,但是,如果我转到“活动”选项卡,我可以在运行管道的同时看到活动。在执行代码签出时,您是否在Jenkins配置中设置了正确的分支?有时,它发生了,你不能看到一行代码,因为这已经发生在我身上。在给出正确的分支之后,我可以看到代码行。我可以知道,您正在分析哪个分支进行代码分析吗?