1.安装7z打包工具并添加到环境变量
将项目下载到目录
2.执行下面脚本
@echo off SETLOCAL EnableDelayedExpansion :: 检查 edata-dataops-ui 目录是否存在 if not exist edata-dataops-ui ( echo Directory edata-dataops-ui does not exist. exit /b 1 ) :: 进入 edata-dataops-ui 目录 cd edata-dataops-ui :: 执行 git pull git pull if errorlevel 1 ( echo Git pull failed in edata-dataops-ui. exit /b 1 ) :: 退回上级目录 cd .. :: 检查 edata-dataops-server 目录是否存在 if not exist edata-dataops-server ( echo Directory edata-dataops-server does not exist. exit /b 1 ) :: 进入 edata-dataops-server 目录 cd edata-dataops-server :: 执行 git pull git pull if errorlevel 1 ( echo Git pull failed in edata-dataops-server. exit /b 1 ) :: 执行 Maven 构建 call mvn clean install -DskipTests if errorlevel 1 ( echo Maven build failed. exit /b 1 ) :: 等待打包完成 echo Waiting for build to complete... timeout /t 60 /nobreak >nul :: 复制并重命名 jar 文件 if exist ..\edata-dataops-server.jar del ..\edata-dataops-server.jar copy target\edata-dataops-server-1.1-SNAPSHOT-jar-with-dependencies.jar ..\edata-dataops-server.jar if errorlevel 1 ( echo Failed to copy jar file. exit /b 1 ) :: 打包 edata-dataops-ui 和 edata-dataops-server.jar 到一个 zip 包中 cd .. 7z a edata-dataops-package.zip edata-dataops-ui edata-dataops-server.jar if errorlevel 1 ( echo Failed to create zip package. exit /b 1 ) echo Script completed successfully. endlocal
标签:脚本,jar,server,window,ui,edata,dataops,打包,echo From: https://www.cnblogs.com/zhangshiwen/p/18527166