#!/bin/sh # 克隆项目源码,编译打包,部署到服务器 CURRENT_DIR=`pwd` PROJECT_NAME="cooleshow" PROJECT_LIBS="libs" GIT_URL="http://10.206.0.11/yonge/cooleshow.git" GIT_BRANCH="master" # 删除旧的项目 rm -rf ${PROJECT_NAME} echo "delete ${PROJECT_NAME} done" # 克隆项目 git clone ${GIT_URL} -b ${GIT_BRANCH} echo "git clone done" cp build.sh ${PROJECT_NAME} # 进入项目目录编译打包 cd ${PROJECT_NAME} && ./build.sh if [ $? -eq 0 ];then echo 'mvn compile ok!'; else echo 'mvn compile failed!'; exit 1; fi # 复制项目jar包到服务器 rm -rf ${CURRENT_DIR}/${PROJECT_LIBS} && mkdir -p ${CURRENT_DIR}/${PROJECT_LIBS} echo "create jar dir done" cp service.md \ cooleshow-user/user-admin/target/user-admin.jar \ audio-analysis/target/audio-analysis.jar \ cooleshow-auth/auth-server/target/auth-server.jar \ cooleshow-bbs/target/cooleshow-bbs.jar \ cooleshow-user/user-classroom/target/user-classroom.jar \ cooleshow-cms/target/cooleshow-cms.jar \ cooleshow-gateway/gateway-web/target/gateway-web.jar \ cooleshow-mall/mall-admin/target/mall-admin.jar \ cooleshow-mall/mall-portal/target/mall-portal.jar \ cooleshow-user/user-student/target/user-student.jar \ cooleshow-task/target/cooleshow-task.jar \ cooleshow-user/user-teacher/target/user-teacher.jar \ cooleshow-user/user-website/target/user-website.jar \ cooleshow-user/user-tenant/target/user-tenant.jar \ cooleshow-websocket/target/cooleshow-websocket.jar \ ${CURRENT_DIR}/${PROJECT_LIBS}/ echo "copy jar done" # 服务启动 if [ -f ${CURRENT_DIR}/jenkins-server.sh ];then echo "./jenkins-server.sh server" cd ${CURRENT_DIR} && ./jenkins-server.sh server else echo "jenkins-server.sh not exist" exit 1; fi