|
|
|
|
@ -765,71 +765,6 @@ pipeline {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stage('6.7 重命名制品') {
|
|
|
|
|
when {
|
|
|
|
|
expression { currentBuild.result == null || currentBuild.result == 'SUCCESS' || currentBuild.result == 'UNSTABLE' }
|
|
|
|
|
}
|
|
|
|
|
steps {
|
|
|
|
|
echo '========== 重命名构建制品 =========='
|
|
|
|
|
script {
|
|
|
|
|
try {
|
|
|
|
|
// 恢复并行打包的制品
|
|
|
|
|
echo '恢复制品从 stash...'
|
|
|
|
|
unstash 'build-artifacts'
|
|
|
|
|
echo '✓ 制品已恢复'
|
|
|
|
|
|
|
|
|
|
bat '''
|
|
|
|
|
@echo off
|
|
|
|
|
REM 收集和重命名构建制品...
|
|
|
|
|
|
|
|
|
|
REM 从各个子目录复制最终制品到 target 目录
|
|
|
|
|
echo 复制 CLI 制品...
|
|
|
|
|
if exist "target\\cli\\slms-1.0-SNAPSHOT.war" (
|
|
|
|
|
copy /Y "target\\cli\\slms-1.0-SNAPSHOT.war" "target\\slms-cli.war"
|
|
|
|
|
echo ✓ CLI WAR 已复制并重命名为: slms-cli.war
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
echo 复制 GUI 制品...
|
|
|
|
|
if exist "target\\gui\\slms-1.0-SNAPSHOT.war" (
|
|
|
|
|
copy /Y "target\\gui\\slms-1.0-SNAPSHOT.war" "target\\slms-gui.war"
|
|
|
|
|
echo ✓ GUI WAR 已复制并重命名为: slms-gui.war
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
echo 重命名 Web 制品...
|
|
|
|
|
if exist "target\\web\\slms-1.0-SNAPSHOT.war" (
|
|
|
|
|
copy /Y "target\\web\\slms-1.0-SNAPSHOT.war" "target\\slms-web.war"
|
|
|
|
|
echo ✓ Web WAR 文件已重命名为: slms-web.war
|
|
|
|
|
) else (
|
|
|
|
|
echo ⚠️ 警告: 找不到 target\\web\\slms-1.0-SNAPSHOT.war
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
REM 复制数据库文件(如果存在)
|
|
|
|
|
if exist "target\\web\\library.db" (
|
|
|
|
|
copy /Y "target\\web\\library.db" "target\\library.db"
|
|
|
|
|
echo ✓ 数据库文件已复制
|
|
|
|
|
) else if exist "library.db" (
|
|
|
|
|
copy /Y "library.db" "target\\library.db"
|
|
|
|
|
echo ✓ 数据库文件已从根目录复制
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
REM 检查最终制品是否存在
|
|
|
|
|
echo.
|
|
|
|
|
echo 最终制品检查:
|
|
|
|
|
if exist "target\\slms-cli.war" echo ✓ slms-cli.war
|
|
|
|
|
if exist "target\\slms-gui.war" echo ✓ slms-gui.war
|
|
|
|
|
if exist "target\\slms-web.war" echo ✓ slms-web.war
|
|
|
|
|
if exist "target\\library.db" echo ✓ library.db
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
echo '✓ 制品重命名完成'
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
echo "⚠️ 制品重命名失败: ${e.message}"
|
|
|
|
|
currentBuild.result = 'UNSTABLE'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stage('7. 归档制品') {
|
|
|
|
|
when {
|
|
|
|
|
expression { currentBuild.result == null || currentBuild.result == 'SUCCESS' || currentBuild.result == 'UNSTABLE' }
|
|
|
|
|
@ -905,8 +840,8 @@ pipeline {
|
|
|
|
|
// 归档制品 - 使用 try-catch 确保即使部分文件缺失也能继续
|
|
|
|
|
try {
|
|
|
|
|
echo '开始归档制品...'
|
|
|
|
|
// 归档所有制品: WAR 文件、数据库、文档、APK
|
|
|
|
|
archiveArtifacts artifacts: 'target/slms-*.war,target/library.db,target/README-*.txt,android/build/outputs/apk/debug/*.apk',
|
|
|
|
|
// 归档所有制品: JAR、WAR 文件、数据库、文档、APK
|
|
|
|
|
archiveArtifacts artifacts: 'target/slms-*.jar,target/slms-*.war,target/library.db,target/README-*.txt,target/run-*.bat,android/build/outputs/apk/debug/*.apk',
|
|
|
|
|
fingerprint: true,
|
|
|
|
|
allowEmptyArchive: true,
|
|
|
|
|
onlyIfSuccessful: false
|
|
|
|
|
@ -914,7 +849,7 @@ pipeline {
|
|
|
|
|
|
|
|
|
|
// Stash 制品供后续阶段使用
|
|
|
|
|
echo '保存制品到 stash...'
|
|
|
|
|
stash includes: 'target/slms-*.war,target/library.db,target/README-*.txt,android/build/outputs/apk/debug/*.apk', name: 'build-artifacts', allowEmpty: true
|
|
|
|
|
stash includes: 'target/slms-*.jar,target/slms-*.war,target/library.db,target/README-*.txt,target/run-*.bat,android/build/outputs/apk/debug/*.apk', name: 'build-artifacts', allowEmpty: true
|
|
|
|
|
echo '✓ 制品已保存到 stash'
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
echo "⚠️ 制品归档时出现问题: ${e.message}"
|
|
|
|
|
|