安装插件
- 插件管理中安装 Maven Integration plugin
全局工具配置
Maven
JDK
新建任务
选择构建一个maven项目
配置
cp /root/.jenkins/workspace/growing_backend/target/growing_backend-1.0.0-SNAPSHOT.jar /home/nebula/workspace/growing_backend/growing_backend-1.0.0-SNAPSHOT.jar
chmod 755 /home/nebula/workspace/growing_backend/growing_backend-1.0.0-SNAPSHOT.jar
sh /home/nebula/workspace/growing_backend/stop.sh
sh /home/nebula/workspace/growing_backend/start.sh
stop.sh
#!/bin/sh
PROCESS=`ps -ef | grep growing_backend-1.0.0-SNAPSHOT.jar | grep -v grep | awk '{print $2}'`
if [ "$PROCESS" ]
then
echo "kill $PROCESS"
kill -9 $PROCESS
else
echo "no kill"
fi
start.sh
#!/bin/sh
BUILD_ID=DONTKILLME
cd /home/nebula/workspace/growing_backend
nohup java -jar growing_backend-1.0.0-SNAPSHOT.jar > logs.log &