jenkins之war包部署

1. 插件安装

  • Maven Integration

  • Pipeline Maven Integration

  • Deploy to container

2. 新建任务

3 源码配置

  • Credentials 需要选择在用户列表,配置了该仓库ssh key的用户

4 构建后操作

4.1 部署到服务器

构建后,部署war包到指定服务器,我这里是部署在了本地的tomcat服务上

注意:

  • war文件地址,如果不在当前项目的target下,需要写成类似 **/target/*.war

4.2 上传到私服

我这里是上传到了nexus上

对英需要修改setting.xml

1
2
3
4
5
6
7
8
9
10
11
<server>
<id>SNAPSHOT</id>
<username>deployment</username>
<password>deployment123</password>
</server>

<server>
<id>RELEASE</id>
<username>deployment</username>
<password>deployment123</password>
</server>

5 构建项目

如果构建失败,可以在控制台查看报错信息

6 启动tomcat

可以查看已经部署成功的服务了

7. 登陆nexus

可以看到war包已经上传到了nexus


jenkins之war包部署
http://example.com/jekins支war包部署/
作者
Panyurou
发布于
2023年1月15日
许可协议