Jenkinsfile

main
liangjiajie 1 year ago
parent 79bcf9c2b9
commit 19a22f7944

28
Jenkinsfile vendored

@ -12,20 +12,20 @@ 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 {
try { script {
timeout(time: 5, unit: 'SECONDS') { try {
echo '开始执行 Maven 打包...' // 尝试执行shell命令
sh 'echo 123' sh label: '', script: 'echo 123'
echo 'Maven 打包完成.' } catch (err) {
} // 如果执行时发生异常,则捕获并打印错误信息
} catch (err) { echo "Shell command execution failed: ${err.getMessage()}"
echo "打包出错:${err.getMessage()}" // 这里还可以添加其他处理错误的逻辑,比如发送通知、清理资源等
} }
}
} }
} }
stage('sonar质量检测') { // 阶段3:使用Sonar进行代码质量检测 stage('sonar质量检测') { // 阶段3:使用Sonar进行代码质量检测
steps { steps {
echo 'sonar质量检测--成功' // 打印信息表示质量检测阶段成功完成 echo 'sonar质量检测--成功' // 打印信息表示质量检测阶段成功完成

Loading…
Cancel
Save