-
-
Save tkatochin/e3e44e5bfc276b7e302e to your computer and use it in GitHub Desktop.
プロジェクトごとにローカルリポジトリを切り替えられることができるようにしたmvn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
export repo_path= | |
export ancestor=. | |
while [ "/" != "`cd $ancestor;pwd`" -a ! -d $ancestor/.m2/repository ]; do | |
export ancestor=../${ancestor} | |
done | |
if [ -d $ancestor/.m2/repository ]; then | |
export repo_path=`cd $ancestor/.m2/repository;pwd` | |
else | |
if [ -d ~/.m2/repository ]; then | |
export repo_path=`cd ~/.m2/repository;pwd` | |
else | |
echo Not found .m2/repository | |
exit 1 | |
fi | |
fi | |
export esc_path=${repo_path////\\/} | |
export repo_change_exp="s/<localRepository>.*<\\/localRepository>/<localRepository>${esc_path}<\\/localRepository>/" | |
#echo $repo_change_exp | |
sed -i".org" -E $repo_change_exp ~/.m2/settings.xml | |
/usr/local/bin/mvn $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment