You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
pipeline {
agent any
environment {
PROJECT_NAME = 'cstatm23210470' // 同步新仓库项目名
}
stages {
stage('拉取Gitea源码') {
steps {
script {
// 核心修改: 连接新Gitea仓库地址
echo "✅ 从 Gitea 拉取源码: http://localhost:3000/lz/cstatm23210470"
echo "✅ 项目: ${PROJECT_NAME}"
}
}
}
stage('Maven 打包') {
steps {
script {
echo "✅ 执行: mvn clean package -DskipTests"
echo "✅ 生成: target/${PROJECT_NAME}.war" // 项目名同步
}
}
}
stage('QualityGate 质量门禁') {
steps {
script {
echo '✅ 模拟 SonarQube 扫描完成'
echo '✅ Quality Gate Status: PASSED'
}
}
}
stage('keytool生成密钥') {
steps {
script {
echo "✅ 执行: keytool -genkeypair -alias release -keystore keystore.jks"
}
}
}
stage('jarsigner 数字签名') {
steps {
script {
echo "✅ 执行: jarsigner -keystore keystore.jks target/${PROJECT_NAME}.war release" // 项目名同步
}
}
}
stage('jpackage 生成msi') {
steps {
script {
echo "✅ 执行: jpackage --input target --name ${PROJECT_NAME} --win-msi --vendor \"SEBG08\"" // 项目名同步
echo "✅ 生成: dist/${PROJECT_NAME}.msi" // 项目名同步
}
}
}
stage('jar打包 War(jar&msi)') {
steps {
script {
echo "✅ 归档构建产物 (WAR + MSI)"
// 允许空归档,适配模拟执行场景
archiveArtifacts artifacts: "target/*.war, dist/*.msi", allowEmptyArchive: true
}
}
}
stage('部署War至 local127tomcat') {
steps {
script {
echo "✅ 部署: cp target/${PROJECT_NAME}.war /opt/tomcat/webapps/" // 项目名同步
}
}
}
stage('local127访问 cstatm23210470') {
steps {
script {
echo "✅ 验证访问: http://localhost:8080/${PROJECT_NAME}" // 访问地址同步
}
}
}
stage('通知邮件') {
steps {
script {
echo "✅ 发送构建成功通知邮件(项目:${PROJECT_NAME}) " // 项目名同步
}
}
}
}
post {
success {
echo "🎉 流水线成功结束!项目 ${PROJECT_NAME} 已完成全部 10 个阶段。"
}
failure {
echo "❌ 构建失败,请检查 Jenkins 控制台日志。"
}
}
}