jenkins使用Free-Style(自由風格)方式構建java應用
jenkins使用Free-Style(自由風格)方式構建java應用
這里僅記錄下,防止遺忘~??
項目結構
crm/
crm-api
crm-web
這是一個多模塊項目,crm為主目錄,crm-api為springboot架構后端api模塊,crm-web 為vue架構的前端項目
通用(General)

原始碼管理

建置觸發程序 & 建置環境

建置(執行shell)

#!/bin/sh
cd /usr/test&& rm -rf ./crm-api/crm-api.jar && mv crm-api.jar ./crm-api/crm-api.jar
cd /usr/test/crm-api && /bin/sh ./start.sh && ps -aux |grep -v grep | grep crm-api.jar
建置後動作
-
Send build artifacts over SSH
![]()
![]()
-
start.sh
#!/bin/sh
pid=$(ps -ef | grep "crm-api.jar" | grep -v grep | awk '{print $2}')
echo $pid
if [ ! $pid ]; then
echo "IS NULL"
else
kill -9 $pid
fi
nohup /usr/bin/java -jar crm-api.jar --server.port=5567--spring.profiles.active=test >crm-api_test.out &
funnyzpc@gmail.com



浙公網安備 33010602011771號