新建Item
选择freestyle
配置下拉框
This project is parameterized
配置git
构建shell脚本
脚本
shell
BUILD_ID=DONTKILLME
. /etc/profile
export PROJ_PATH=`pwd`
export TOMCAT_APP_PATH=/root/local/apache-tomcat-8.5.45
export BASE_PATH=/root/local
echo $PROJ_PATH
echo $TOMCAT_APP_PATH
echo $BASE_PATH
if [ "$project" = "wx-mp" ]
then
pid2=`ps -ef | grep mp-demo-8080.jar | grep -v grep | awk '{print $2}'`
echo $pid2
if [ -n "$pid2" ]
then
kill -9 $pid2
fi
cd $PROJ_PATH/wx-study/$project/
mvn clean package -DskipTests
rm -rf $BASE_PATH/mp-demo-8080.jar
cd target/
cp mp-demo-8080.jar $BASE_PATH/
cd $BASE_PATH
nohup java -jar -Xms256m -Xmx256m mp-demo-8080.jar >mp-demo.out &
echo "wx-mp启动成功"
fi