Mark anser, script , .
The main use is to write the form configuration file first ~/.m2/settings.<config>.xml, where <config>is the name of the configuration, and then set the configuration, invoking setmvn [config]without specifying that it will delete the configuration in place. This will symbolically bind to the configuration file, so if your tools change the current configuration, it will change the current configuration file.
#!/bin/bash
[ "$#" -lt 2 ] || {
echo "Usage: $(basename $0) [profile-name]" >&2
exit 1
}
if [ -z "$1" ] ; then
if [ -f ~/.m2/settings.xml ] ; then
echo "Configuration removed."
rm -f ~/.m2/settings.xml
else
echo "Configuration not in place, nothing to do." >&2
fi
else
if [ -f ~/.m2/"settings.$1.xml" ] ; then
[ -f ~/.m2/settings.xml ] && rm -f ~/.m2/settings.xml
ln -s ~/.m2/"settings.$1.xml" ~/.m2/settings.xml
echo "Configuration set to $1."
else
echo "Configuration not found: $1" >&2
exit 2
fi
fi
source
share