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