Skip to content

Instantly share code, notes, and snippets.

@GoSteven
Created December 4, 2012 01:22
Show Gist options
  • Save GoSteven/4199666 to your computer and use it in GitHub Desktop.
Save GoSteven/4199666 to your computer and use it in GitHub Desktop.
Change maven encripted password in ~/.m2/settings.xml
#!/bin/bash
echo Please type your password:
read -s p
encrypted=`mvn --encrypt-password $p`
echo encrypted password for mvn is:
echo $encrypted
#escape /
encrypted=`echo "$encrypted" | sed s,/,\\\\\\\\\\/,g`
echo $encrypted
cd ~/.m2/
cp settings.xml{,_bak}
cat settings.xml_bak | sed s/{.*}/$encrypted/g > settings.xml
p='dummy'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment