-
-
Save lhazlewood/0ffbbb6d3d043c147710 to your computer and use it in GitHub Desktop.
Bash script to switch maven configurations by name
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
#!/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
Nice work, @lhazlewood. I wanted something to swap out the entire
~/.m2
directory, not justsettings.xml
, so I created Maven Environment Manager.