Jenkinsfile

main
liangjiajie 1 year ago
parent 79bcf9c2b9
commit 19a22f7944

16
Jenkinsfile vendored

@ -12,18 +12,18 @@ pipeline {
checkout scmGit(branches: [[name: '${tag}']], extensions: [], userRemoteConfigs: [[url: 'https://git.mashibing.com/msb_134187/ljj_spring_test.git']]) checkout scmGit(branches: [[name: '${tag}']], extensions: [], userRemoteConfigs: [[url: 'https://git.mashibing.com/msb_134187/ljj_spring_test.git']])
} }
} }
stage('maven打包') { // 阶段2:使用maven进行应用打包 stage('Execute Shell Command') {
steps { steps {
script {
try { try {
timeout(time: 5, unit: 'SECONDS') { // 尝试执行shell命令
echo '开始执行 Maven 打包...' sh label: '', script: 'echo 123'
sh 'echo 123'
echo 'Maven 打包完成.'
}
} catch (err) { } catch (err) {
echo "打包出错:${err.getMessage()}" // 如果执行时发生异常,则捕获并打印错误信息
echo "Shell command execution failed: ${err.getMessage()}"
// 这里还可以添加其他处理错误的逻辑,比如发送通知、清理资源等
}
} }
} }
} }
stage('sonar质量检测') { // 阶段3:使用Sonar进行代码质量检测 stage('sonar质量检测') { // 阶段3:使用Sonar进行代码质量检测

Loading…
Cancel
Save