@echo off :: 1. 运行 Maven 打包 echo Running mvn clean package... :: call mvn clean package -P thin-jar call mvn clean package :: 检查是否打包成功 IF %ERRORLEVEL% NEQ 0 ( echo Maven build failed, exiting... exit /b %ERRORLEVEL% ) :: 2. 将 JAR 包传输到 Linux 服务器 echo Copying JAR file to Linux server... call scp target\AdvisorServer-2.6.7.jar root@8.138.144.54:/root :: 检查 SCP 命令是否成功 IF %ERRORLEVEL% NEQ 0 ( echo File transfer failed, exiting... exit /b %ERRORLEVEL% ) :: 3. 通过 SSH 运行 start.sh 脚本 echo Running start.sh script on Linux server... call ssh root@8.138.144.54 'bash /root/start.sh' :: 检查 SSH 命令是否成功 IF %ERRORLEVEL% NEQ 0 ( echo Failed to start the application, exiting... exit /b %ERRORLEVEL% ) echo Deployment successful!