Skip to content

Instantly share code, notes, and snippets.

@thomashartm
Last active August 29, 2015 14:27
Show Gist options
  • Save thomashartm/00911e7096d291d43d7a to your computer and use it in GitHub Desktop.
Save thomashartm/00911e7096d291d43d7a to your computer and use it in GitHub Desktop.
Set envrionment specific maven settings by symlinking prepared env specific settings.xml files.
#!/bin/bash
####################################
# Prepares dev environment settings
# call:
# set-dev-env <environment>
# or for help:
# set-dev-env
####################################
list_envs()
{
echo -e "Prepare dev environment settings."
echo -e "Usage\t\t: set-dev-env <environment>"
echo -e "Available environments:"
echo -e "aem"
echo -e "atlas"
echo -e "java"
exit 1
}
FILE=""
set +x
if [ "$1" == "aem" ]; then
echo -e "Init AEM settings. Proxies all requests using corporate nexus."
FILE="settings.xml.aem"
elif [ "$1" == "java" ]; then
echo -e "Init plain maven central settings for java projects."
FILE="settings.xml.central"
elif [ "$1" == "atlas" ]; then
echo -e "Init Atlassian SDK settings."
FILE="settings.xml.atlassian"
else
list_envs
exit 1
fi
if [ -n "$FILE" ]; then
SETTINGS_XML="$HOME/.m2/settings.xml"
echo -e "Replacing $SETTINGS_XML"
if [ -f $SETTINGS_XML ]; then
rm $SETTINGS_XML
fi
ln -s $HOME/.m2/$FILE $SETTINGS_XML
fi
set -x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment