erp-pro/images/util/doc/shell/javawebdeploy/package.sh
DESKTOP-ESU4BDD\WeiZhiQiang 50ec1db258 feat: 代码迁移
2024-08-30 11:38:45 +08:00

58 lines
1.1 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# SVN检出并Maven打包
#
# 参数:
# $1 UUID
# $2 SVN地址
# $3 项目部署路径
# $4 版本控制系统(1.SVN;2.GIT)
# $5 Maven profile
# $6 Git分支
# $7 如果一个git地址上有多个项目则为目录节点
if [ -z "$1" ]||[ -z "$3" ]; then
echo "参数不能为空"
exit 0
fi
if [ $4 -eq 1 ]
then
svn checkout $2 .
else
if [ ! -d "$3/$1" ];then
echo "工程文件夹不存在,开始创建"
mkdir -p $3/$1
# 进入到工程文件夹目录
echo "*****cd $3/$1*****"
cd $3/$1
echo "开始克隆项目"
git clone --depth 1 $2 .
if [ "$6" != "null" ]; then
git checkout $6
fi
else
echo "工程文件夹已存在"
# 进入到工程文件夹目录
echo "*****cd $3/$1*****"
cd $3/$1
echo "开始拉取项目"
git pull $2
echo "拉取项目结束."
fi
fi
echo "***** 目录节点: $7 *****"
if [ ! -z "$7" ]; then
echo "*****cd $7*****"
cd $7
fi
# 开始打包
echo "*****开始打包*****"
echo "***** Maven profile: $5 *****"
if [ "$5" != "null" ]; then
mvn clean package -Dmaven.test.skip=true -P$5
else
mvn clean package -Dmaven.test.skip=true
fi