Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
change_version.sh 928 Bytes
Copy Edit Raw Blame History
#!/bin/bash
shopt -s expand_aliases
if [ ! -n "$1" ] ;then
echo "Please enter a version"
exit 1
else
echo "The updated version is $1 !"
fi
currentVersion=`sed -n '/<project /,/<packaging/p' pom.xml | grep version | cut -d '>' -f2 | cut -d '<' -f1`
echo "The current version is $currentVersion"
if [ `uname` == "Darwin" ] ;then
echo "This is OS X"
alias sed='sed -i ""'
else
echo "This is Linux"
alias sed='sed -i'
fi
echo "Change version in root pom.xml ===>"
sed "/<project /,/<packaging/ s/<version>.*<\/version>/<version>$1<\/version>/" pom.xml
echo "Change version in subproject pom ===>"
for filename in `find . -name "pom.xml" -mindepth 2`;do
echo "Deal with $filename"
sed "/<parent>/,/<\/parent>/ s/<version>.*<\/version>/<version>$1<\/version>/" $filename
done
for filename in `find . -name "README*.md"`;do
echo "Deal with $filename"
sed "/badge\/maven/! s/$currentVersion/$1/" $filename
done
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化