目录
本文主要讲解Jenkins自动部署项目到Tomcat容器下的关键配置
1.安装jenkins 插件
Jenkins自动将项目打包部署到Tomcat下需要【Deploy to container Plugin】插件。
2.增加构建后操作步骤
3.配置tomcat远程部署账号
在tomcat目录下conf文件内tomcat-users.xml 配置文件中的标签中进行配置,此处设置tomcat8080为远程部署账号,需要具备:manager,manager-gui,manager-script,manager-jmx,manager-status权限,否则报错; 如使用nginx代理,则需要设置最大缓冲大小大于war包大小,否则报错.
<role rolename="manager"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<user username="tomcat8080" password="*****" roles="manager,manager-gui,manager-script,manager-jmx,manager-status"/>
https://blog.csdn.net/fly_leopard/article/details/79654254
https://blog.csdn.net/gongxsh00/article/details/80861214
4.立即构建项目
配置完成后,重启tomcat服务,然后去jenkins里面点击立即构建,项目将会自动发布至相应web容器,并再次自动重启tomcat服务。
5.拓展(tomcat 角色的定义)
关于tomcat 角色的定义,详见的 manager 应用服务目录下的 web.xml文件。
- manager-gui —Access to the HTML interface.
- manager-script — Access to the tools-friendly plain text interface that is described in this document, and to the “Server Status” page.
- manager-jmx — Access to JMX proxy interface and to the “Server Status” page.
- manager-status — Access to the “Server Status” page only.