安装插件
除此之外,还要有git,maven等必要的插件
在系统管理-系统配置中,添加远程的服务器
创建maven项目,在Post Steps中添加Send files or execute commands over SSH步骤
再添加Execute shell script on remote host using ssh步骤
# 打包后的jar名称
app=gateway-1.0.0
#如果当前jar包已经运行,记录下进程id
app_pid=`ps -ef | grep "$app.jar" | grep -v grep | awk '{print $2}'`
#进入jar包目录
cd /data/net/
#杀死旧进程
kill -9 $api_pid
#防止进程被杀死
BUILD_ID=dontKillMe
#后台运行,输出日志和错误到out.log
nohup java -jar $app.jar >> out.log 2>&1 &
echo $app start success