1 Star 0 Fork 3

SmallSaaS/jenkins_scripts

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
fatjar-cfr 1.81 KB
一键复制 编辑 原始数据 按行查看 历史
m.2@sandbox 提交于 2023-02-28 20:12 . add fatjar-*
#!/usr/bin/env bash
ARTIFACT='com.tools:dev-dependency:1.0:jar:all'
artifact='dev-dependency-1.0-all.jar'
artifact_ls="/var/tmp/$artifact"
artifact_cli='fatjar-cfr'
readdir(){
bin=$1
local dir=$(which $1)
dir=${dir%/*}
if [ -d $dir/node_modules/dev-cli ];then
dir=$dir/node_modules/dev-cli
fi
if [[ $(uname -s) = Darwin ]];then
dir=${dir%/*}/lib/node_modules/dev-cli
fi
echo $dir
}
getartifact(){
if [ ! -d /var/tmp ];then
mkdir -p /var/tmp
fi
if [ ! -f $artifact_ls ];then
mvn org.apache.maven.plugins:maven-dependency-plugin:3.2.0:copy -Dartifact=$ARTIFACT -DoutputDirectory=/var/tmp
fi
if [ ! -f $artifact_ls ];then
local dir="$(readdir $artifact_cli)"
echo fail to mvn copy $ARTIFACT > /dev/stderr
echo "1> cp $dir/lib/$artifact ./$artifact_ls" > /dev/stderr
cp $dir/lib/$artifact ./$artifact_ls
fi
}
if [ ! -f $artifact_ls ];then
getartifact
fi
## main
usage(){
echo 'fatjar-cfr <fatjar> [entry] [pattern]'
exit 1
}
fatjar_opt=$9
entry_opt=$9
pattern_opt=$9
for opt in $@;do
if [ $entry_opt ];then
pattern_opt=$opt
elif [ $fatjar_opt ];then
pattern_opt=$opt
entry_opt=$opt
else
fatjar_opt=$opt
fi
done
# echo entry_opt=$entry_opt, pattern_opt=$pattern_opt
## ensure fatjar
if [ ! $fatjar_opt ];then
usage
fi
## update pattern_opt
if [ $entry_opt ];then
if [ $pattern_opt != $entry_opt ];then
pattern_opt="$entry_opt!$pattern_opt"
fi
fi
if [ $pattern_opt ];then
pattern_arg="-i $pattern_opt"
fi
if [ $pattern_opt ];then
# echo java -jar $artifact_ls $fatjar_opt $checksum_opt $pattern_arg
java -jar $artifact_ls $fatjar_opt $checksum_opt $pattern_arg
else
# echo java -jar $artifact_ls $fatjar_opt $checksum_opt -T
java -jar $artifact_ls $fatjar_opt $checksum_opt -T
fi
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/smallsaas/jenkins_scripts.git
git@gitee.com:smallsaas/jenkins_scripts.git
smallsaas
jenkins_scripts
jenkins_scripts
master

搜索帮助