diff --git a/Jenkinsfile b/Jenkinsfile index 0450b7a..c56248a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -53,7 +53,16 @@ pipeline { } post { always { - junit testResults: 'target/surefire-reports/*.xml' + script { + // 检查测试报告文件是否存在 + def reportFiles = findFiles(glob: 'target/surefire-reports/TEST-*.xml') + if (reportFiles.length > 0) { + echo "找到 ${reportFiles.length} 个测试报告文件" + junit testResults: 'target/surefire-reports/TEST-*.xml' + } else { + echo "未找到测试报告文件,跳过JUnit发布" + } + } } } }