See this page for information:
http://maven.apache.org/guides/mini/guide-encryption.html
To encrypt passwords in the file
settings.xml,
you need, first, to create a Maven
master password
which will be used by Maven to encrypt/decrypt your passwords:
Then you need to create a new file
${HOME}/.m2/settings-security.xml
and add to it the master password as following:
Once done you can encrypt your passwords using the following command:
Copy the generated password and replace its, clear text, occurrence in the file
settings.xml.
Maven will be aware that the password was encrypted and will use the master password to decrypt it when it needs to have access to the clear text password.
Note:
The password is an optional argument for the commands
mvn -emp and
mvn -ep.
If you omit the password, you will be prompted for it.
This will avoid the need to escape any special character in your password.
Also it will avoid that the shell stores your password in its history of commands.