Bash script to switch maven configurations by name
#!/usr/bin/env bash | |
LINK_FILE="$HOME/.m2/settings.xml" | |
if [ ! -L "$LINK_FILE" ]; then | |
echo "This program expects $LINK_FILE to be a symbolic link." | |
exit 1 | |
fi | |
if [ -z "$1" ]; then | |
ls -lah "$LINK_FILE" | |
#out=$(ls -alh "$LINK_FILE") | |
#echo "$out" | |
exit 0 | |
fi | |
TARGET_FILE="$HOME/.m2/$1.settings.xml" | |
if [ ! -f "$TARGET_FILE" ]; then | |
echo "$TARGET_FILE does not exist." | |
exit 1 | |
fi | |
ln -sf "$TARGET_FILE" "$LINK_FILE" | |
ls -lah "$LINK_FILE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Nice work, @lhazlewood. I wanted something to swap out the entire
~/.m2
directory, not justsettings.xml
, so I created Maven Environment Manager.