echo "输入参数:%inputStr%" if "swdj"=="%inputStr%" ( set jarName=zzs_swdj set jarPath=D:\Developer\IdeaProjects\swdj\target\zzs_swdj.jar set projectDir=D:\Developer\IdeaProjects\dzfp_xc\zzs_swdjkphd rem 远程服务器信息 set remoteBashPath=/data/swdj_startup.sh ) ^ elseif "fpkj"=="%inputStr%" ( set jarName=zzs_fpkj set projectDir=D:\Developer\IdeaProjects\fpkj set jarPath=D:\Developer\IdeaProjects\fpkj\target\zzs_fpkj.jar rem 远程服务器信息 set remoteBashPath=/data/fpkj_startup.sh ) ^ else ( echo "参数错误" ) echo%jarName%
set jarDir=D:\Developer\IdeaProjects\ rem 远程服务器信息 #性能:124.70.81.5 功能:119.3.224.85 set remoteIp=124.70.81.5 set remoteUser=root set remotePwd=LWiQ1U0B set remoteDirPath=/data/jars/%jarName% rem set remoteBashPath=/data/fpkj_startup.sh
if "true" == "%isUpload%" ( echo ">>>>>>>>>>>>>>>>>>>只是上传文件" goto :upload ) rem >>>>>>>>>>>>>>>>>>>>>> svn更新 echo ">>> 开始更新应用" echo%projectDir% cd /d %projectDir% svn update rem >>>>>>>>>>>>>>>>>>>>>> maven构建 echo ">>> 开始构建应用" call mvn clean package echo ">>> 构建应用成功" rem >>>>>>>>>>>>>>>>>>>>>> 复制jar包 echo ">>> 复制jar包" cd /d %jarDir%
echo "%date:~0,4%%date:~5,2%%date:~8,2%" set dateStr="%date:~5,2%%date:~8,2%" set timeStr="%time:~0,2%%time:~3,2%"
set /a jarNum=0 for /f %%iin ('dir /b/o-d/a-d %jarDir%\%jarName%_%dateStr%*.jar') do ( set /a jarNum += 1 ) set /a jarNum += 1 set newJarName= if%jarNum%lss10 ( set newJarName=%jarName%_%dateStr%_0%jarNum%_dev128.jar ) else ( set newJarName=%jarName%_%dateStr%_%jarNum%_dev128.jar ) copy%jarPath%%newJarName% echo ">>> 复制jar包成功" echo%newJarName% rem >>>>>>>>>>>>>>>>>>>>>> 上传jar包 goto :ok :upload
echo "远程服务器IP:%remoteIp%" echo%remoteDirPath% rem 查找目录下日期最新的文件 for /f %%iin ('dir /b/o-d/a-d %jarDir%\%jarName%*.jar') do ( echo%%i echo ">>> 开始上传文件" pscp -l %remoteUser% -pw %remotePwd% -P 22 -r ./%%i%remoteUser%@%remoteIp%:%remoteDirPath% echo ">>> 上传文件成功"