1.配置远程链接

  (1) 点击系统管理------>系统配置

jenkins 远程发布springboot项目

 (2)进入系统配置下拉到Publish over SSH

jenkins 远程发布springboot项目

 

Passphrase:服务器密码

name:自定义名称

hostname:服务器ip

username:服务器用户名

remote directory:远程服务路径,此地方填写后在构建设置构建后操作中的remote directory 就不用再填写了,这两个地方是一样的,前面设置后面就不用设置了,除非往下设置子目录。如下图

jenkins 远程发布springboot项目

 

 

2.构建项目如下图所示:

(1)

jenkins 远程发布springboot项目

(2)

jenkins 远程发布springboot项目

(3)

jenkins 远程发布springboot项目

(4)

jenkins 远程发布springboot项目

(5)

    在第一步创建完远程链接后,在SSH publishers中可以选择已创建的链接

jenkins 远程发布springboot项目

注意:在填写exec command 时需要加source /etc/profile java 环境才能生效

填写完后直接点击立即构建即可

相关文章: