fix: fix Jenkinsfile syntax errors - remove extra braces

This commit is contained in:
wangtianqi 2025-06-23 21:47:45 +08:00
parent 9c995305b4
commit aaa3c78706

20
Jenkinsfile vendored
View File

@ -64,10 +64,10 @@ pipeline {
'''
// 设置Maven命令
env.MVN_CMD = 'mvn'
echo "✅ 构建环境检查完成Maven命令: ${env.MVN_CMD}"
env.MVN_CMD = 'mvn' echo "✅ 构建环境检查完成Maven命令: ${env.MVN_CMD}"
}
}
}
} }
stage('编译') {
steps {
@ -75,12 +75,12 @@ pipeline {
sh "mvn clean compile -DskipTests=true"
}
}
stage('单元测试') {
steps {
echo '🧪 运行单元测试...'
sh "mvn test"
} post {
}
post {
always {
script {
// 发布测试结果
@ -92,8 +92,7 @@ pipeline {
if (fileExists('target/site/jacoco/jacoco.xml')) {
publishCoverage adapters: [jacocoAdapter('target/site/jacoco/jacoco.xml')], sourceFileResolver: sourceFiles('STORE_LAST_BUILD')
} else if (fileExists('target/jacoco.exec')) {
echo '⚠️ 发现jacoco.exec文件但推荐使用XML格式的覆盖率报告'
} else {
echo '⚠️ 发现jacoco.exec文件但推荐使用XML格式的覆盖率报告' } else {
echo '⚠️ 未找到JaCoCo覆盖率报告文件'
}
}
@ -101,7 +100,8 @@ pipeline {
}
}
stage('代码质量扫描') { steps {
stage('代码质量扫描') {
steps {
echo '🔍 运行SonarQube代码扫描...'
script {
try {
@ -116,9 +116,9 @@ pipeline {
echo "✅ SonarQube代码扫描完成"
} catch (Exception e) {
echo "⚠️ SonarQube扫描失败继续构建流程: ${e.getMessage()}"
}
}
} }
}
}
stage('打包') {
steps {