ssh plugin
org.hidetake.ssh
配置build.gradle文件
//引入插件,此插件依赖war插件
plugins {
id 'war'
id 'org.hidetake.ssh' version '2.9.0'
}
//远程服务器信息
remotes {
webServer {
host = '172.18.112.102'
user = 'root'
password = 'lingyi2016'
}
}
//创建远程部署任务
task deployT(dependsOn: war) << {
ssh.run {
session(remotes.webServer) {
put from: war.archivePath.path, into: '/opt/test/apache-tomcat-8.5.15/webapps'
execute "service tomcat restart"
}
}
}配置tomcat服务
Last updated
Was this helpful?