36 lines
1.1 KiB
Batchfile
36 lines
1.1 KiB
Batchfile
@echo off
|
|
setlocal
|
|
set SRC=D:\qhmes-src
|
|
set GIT="C:\Program Files\Git\cmd\git.exe"
|
|
set DEPLOY_DIR=D:\qhmes
|
|
set JAR_NAME=jeecg-system-start-3.9.2.jar
|
|
set SVC=D:\qhmes\qhmes-service.exe
|
|
set BUILT_JAR=%SRC%\jeecg-boot\jeecg-module-system\jeecg-system-start\target\%JAR_NAME%
|
|
|
|
echo [1/5] git pull ...
|
|
cd /d %SRC%
|
|
%GIT% pull
|
|
if errorlevel 1 ( echo [ERROR] git pull failed & pause & exit /b 1 )
|
|
|
|
echo [2/5] maven package with prod profile ...
|
|
cd /d %SRC%\jeecg-boot
|
|
call mvn clean package -pl jeecg-module-system/jeecg-system-start -am -DskipTests -P prod -T 1C
|
|
if errorlevel 1 ( echo [ERROR] build failed & pause & exit /b 1 )
|
|
if not exist "%BUILT_JAR%" ( echo [ERROR] built jar not found & pause & exit /b 1 )
|
|
|
|
echo [3/5] stop service ...
|
|
"%SVC%" stop
|
|
timeout /t 6 /nobreak >nul
|
|
|
|
echo [4/5] copy new jar ...
|
|
copy /Y "%BUILT_JAR%" "%DEPLOY_DIR%\%JAR_NAME%"
|
|
if errorlevel 1 ( echo [ERROR] copy failed, jar locked? & pause & exit /b 1 )
|
|
|
|
echo [5/5] start service ...
|
|
"%SVC%" start
|
|
|
|
echo.
|
|
echo ===== DEPLOY DONE =====
|
|
echo Check log: powershell -Command "Get-Content D:\qhmes\logs\qhmes-service.out.log -Wait -Tail 50"
|
|
endlocal
|
|
pause |