maven项目打包脚本

在多项目需要打包安装时采用的打包脚本

#!/bin/bash


package_path=$(cd $(dirname $0); pwd)
# 打包
function package_cmd() {
    mvn clean package install -Dmaven.test.skip=true -Dcheckstyle.skip=true
}
# 拷贝
function find_package() {
# 查找并拷贝文件
find ./ -iname *.tar.gz -type f | xargs -i cp {} ${package_path}

if [[ -d "$(pwd)" ]]; then
echo "清理目录..."
rm -rf $(pwd)
fi
echo "打包完成,文件路径:${package_path}"
cd ..
}
# 参数说明 1 = git_path  2 = branch
function package() {
git_path=$1
project_name=$(basename ${git_path##*/} .git)

if [[ -d "${package_path}/${project_name}" ]]; then
  echo "目标路径 '${project_name}' 已经存在"
  exit 1
fi
echo "开始打包..."
# git 拉取指定分支项目
git clone -b $2 ${git_path}
# assembly
cd ${package_path}/${project_name}
# 编译打包
package_cmd
if [[ $? -ne 0 ]];then
	echo "编译出错"
	exit 1
fi
find_package
}
# 要打包的git项目地址
rest_utils=https://github.com/confluentinc/rest-utils.git
rest_utils_branch=5.5.0-post
# 打包
package ${rest_utils} ${rest_utils_branch}



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值