代码拉取完成,页面将自动刷新
#!/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-find'
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-find [OPTIONS] <fatjar> [pattern]'
echo ''
echo 'OPTIONS: '
echo ' -c --checksum --output with checksum'
exit 1
}
fatjar_opt=$9
pattern_opt=$9
checksum_opt=$9
for opt in $@;do
if [[ $opt = '-c' || $opt = '--checksum' ]];then
checksum_opt=$opt
elif [ $fatjar_opt ];then
pattern_opt=$opt
else
fatjar_opt=$opt
fi
done
if [ ! $fatjar_opt ];then
usage
fi
if [ $pattern_opt ];then
pattern_arg="-s $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
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。