一、yum安装
在Linux上是有yum安装Git,非常简单,只需要一行命令
yum -y install git
二、maven安装
参考https://www.jianshu.com/p/51e4e84e02cd
三、编写脚本
脚本步骤如下:
- git更新代码
- maven打包
- 停止服务
- 启动服务
1、新建脚本文件:vi test.sh ## 脚本内容如下
2、 chmod 777 test.sh ## 给文件添加可读可写可执行权限
#!/bin/sh
#项目的git地址
git_path=""
#本地代码位置代码路径
code_path="/usr/test/client/"
#项目名称
projectName="test"
projectName3="test-admin"
env="master"
#如果项目文件夹不存在说明没有下载过改项目代码,需要检出该项目
if [ ! -d ${code_path}${projectName} ];
then
echo ${projectName}"不存在,检出该项目"
cd $code_path
git clone "https://user:password@gitee.com/test.git&#