diff --git a/Jenkinsfile b/Jenkinsfile index 91551dd..78551ab 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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 ''' }