fix: 修复SonarQube JaCoCo覆盖率行号不匹配错误 - 在SonarQube扫描前清理旧的JaCoCo XML报告 - 移除命令行中的jacoco路径参数避免导入过期数据

main
SLMS Development Team 1 month ago
parent e3c0340c41
commit d34199ea06

11
Jenkinsfile vendored

@ -89,6 +89,16 @@ pipeline {
steps {
echo '>>> 执行 SonarQube 代码质量检测'
withSonarQubeEnv('SonarQube') {
// 先删除旧的JaCoCo报告避免行号不匹配错误
bat '''
@echo off
echo 清理旧的JaCoCo报告...
del /s /q core\\build\\reports\\jacoco\\test\\*.xml 2>nul
del /s /q cli\\build\\reports\\jacoco\\test\\*.xml 2>nul
del /s /q gui\\build\\reports\\jacoco\\test\\*.xml 2>nul
del /s /q backend\\build\\reports\\jacoco\\test\\*.xml 2>nul
echo 已清理旧报告
'''
bat '''
gradlew.bat sonar ^
-Dsonar.projectKey=%SONAR_PROJECT_KEY% ^
@ -96,7 +106,6 @@ pipeline {
-Dsonar.host.url=%SONAR_HOST_URL% ^
-Dsonar.gradle.skipCompile=true ^
-Dsonar.java.binaries=core/build/classes/java/main ^
-Dsonar.coverage.jacoco.xmlReportPaths=core/build/reports/jacoco/test/jacocoTestReport.xml,cli/build/reports/jacoco/test/jacocoTestReport.xml,gui/build/reports/jacoco/test/jacocoTestReport.xml,backend/build/reports/jacoco/test/jacocoTestReport.xml ^
--no-daemon
'''
}

Loading…
Cancel
Save