Friday 11 September 2020

Generate settings-security.xml file for maven password encryption

 mvn --encrypt-master-password does not create a file security-settings.xml

  1. Use the command mvn --encrypt-master-password to generate a master password. Remember this password.
  2. Create a new file security-settings.xml in ${user.home}/.m2/. For example, on Mac OS X or Ubuntu as ~/.m2/settings-security.xml.

Write into this file:

<settingsSecurity>
  <master>OUTPUT OF THE COMMAND: mvn --encrypt-master-password</master>
</settingsSecurity>

e.g.:

<settingsSecurity>
  <master>{jSMOWnoPFgsHVpMvz5VrIt5kRbzGpI8u+9EF1iFQyJQ=}</master>
</settingsSecurity>

After that the maven encrypt command works on the command line:

mvn --encrypt-password

As mentioned by khmarbaise, more detailed information can be found here: https://maven.apache.org/guides/mini/guide-encryption.html


source