一、后台发布
1、General配置
2、源码管理
3、构建触发器
4、构建环境
5、构建
clean install -Dmaven.test.skip=true -Ptest
6、Post Steps
call "C:UsersAdministratorDesktopstopTomcat.bat"
call "C:UsersAdministratorDesktop
un-mes.bat"
stopTomcat.bat @echo off set CATALINA_HOME=C:javaapache-tomcat-8.5.55 set CATALINA_BASE=C:javaapache-tomcat-8.5.55 set CATALINA_TMPDIR=C:javaapache-tomcat-8.5.55 cd "C:javaapache-tomcat-8.5.55in" title Tomcat重啟脚本 call shutdown.bat ping -n 6 127.1 >nul exit
run-mes.bat @echo off set BUILD_ID=dontkillme set CATALINA_HOME=C:javaapache-tomcat-8.5.55 set CATALINA_BASE=C:javaapache-tomcat-8.5.55 set CATALINA_TMPDIR=C:javaapache-tomcat-8.5.55 cd "C:javaapache-tomcat-8.5.55webapps" if exist "C:javaapache-tomcat-8.5.55webappsmes-api.war" del "C:javaapache-tomcat-8.5.55webappsmes-api.war" cd "C:UsersAdministrator.jenkinsjobslh-mesworkspacemes-applications-parentmes-applications-api arget" copy "C:UsersAdministrator.jenkinsjobslh-mesworkspacemes-applications-parentmes-applications-api argetmes-api.war" "C:javaapache-tomcat-8.5.55webappsmes-api.war" if exist "C:javaapache-tomcat-8.5.55webappsmes-api" rd /s /q "C:javaapache-tomcat-8.5.55webappsmes-api" cd "C:javaapache-tomcat-8.5.55in" call startup.bat ping -n 45 127.1 >nul echo good bye
二、前台发布
1、开始配置同上,构建环境
2、构建
npm i
npm run build
call "C:UsersAdministratorDesktopstopTomcat.bat"
call "C:UsersAdministratorDesktop
un-mes-web.bat"
stopTomcat.bat @echo off set CATALINA_HOME=C:javaapache-tomcat-8.5.55 set CATALINA_BASE=C:javaapache-tomcat-8.5.55 set CATALINA_TMPDIR=C:javaapache-tomcat-8.5.55 cd "C:javaapache-tomcat-8.5.55in" title Tomcat重啟脚本 call shutdown.bat ping -n 6 127.1 >nul exit
run-mes-web.bat @echo off set BUILD_ID=dontkillme set CATALINA_HOME=C:javaapache-tomcat-8.5.55 set CATALINA_BASE=C:javaapache-tomcat-8.5.55 set CATALINA_TMPDIR=C:javaapache-tomcat-8.5.55 if exist "C:javaapache-tomcat-8.5.55webappsmes" rd /s /q "C:javaapache-tomcat-8.5.55webappsmes" md "C:javaapache-tomcat-8.5.55webappsmes" cd "C:UsersAdministrator.jenkinsjobslh-mes-webworkspace" xcopy "C:UsersAdministrator.jenkinsjobslh-mes-webworkspacedist*.*" "C:javaapache-tomcat-8.5.55webappsmes" /s /e /c /y /h /r cd "C:javaapache-tomcat-8.5.55in" call startup.bat ping -n 45 127.1 >nul echo good bye
三、问题记录
1、进入jenkins启动项目构建后,出现tomacat闪退现象,现象为jenkins会杀死Tomcat进程
解决方案:bat命令中设置BUILD_ID环境变量,修改BUILD_ID序号,例如:set BUILD_ID=dontkillme