手记

Jenkins自动构建项目

安装

官网上下载war包扔到tomcat的webapp下,启动tomcat即可

配置Gradle

push | merge自动构建

配置触发器

Gitlab添加WebHook

自动杀死上个进程并启动新的jar

杀死上个进程

#!/bin/sh

tomcat_id=`ps -ef | grep sso | grep -v "grep" | awk '{print $2}'`
echo $tomcat_id

for id in $tomcat_id
do
    kill -9 $id  
    echo "killed $id"  
done

启动新的进程

BUILD_ID=dontKillMe
nohup java -jar /root/.jenkins/workspace/邳州养老平台/default/pension-sso/build/libs/pension-sso-0.0.1-SNAPSHOT.jar
BUILD_ID=dontKillMe
nohup java -agentpath:/root/jrebel/lib/libjrebel64.so  -Drebel.remoting_port=18303  -Drebel.remoting_plugin=true  -Xms256m -Xmx256m  -Xdebug -Xrunjdwp:transport=dt_socket,address=18302,server=y,suspend=n -jar /root/.jenkins/workspace/邳州养老平台/default/pension-sso/build/libs/pension-sso-0.0.1-SNAPSHOT.jar > /opt/logs/sso/dev.log 2>&1 &

Idea配置可视化

Jenkins添加Token

/jenkins/user/用户/configure


复制生成的Token,就是访问密码

启用代理兼容


获取Crumb

[crumbIssuer/api/xml?tree=crumb#] jenkinsserver:port/crumbIssuer/api/xml?tree=crumb#

配置idea




by 朱永胜

1人推荐
随时随地看视频
慕课网APP