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