Table of Contents

About

How to manage credentials:

  • login
  • password

within Maven

Steps

Create the master password

  • Encrypt the master password
mvn --encrypt-master-password <MasterPassword>
# or
mvn -emp <MasterPassword>
  • Saved it by creating the file m2_home/.m2/settings-security.xml
<settingsSecurity>
      <master>The master password created above {jSMOWnoPFgsHVpMvz5VrIt5kRbzGpI8u+9EF1iFQyJQ=}</master>
</settingsSecurity>

Generate password and define credentials

mvn --encrypt-password <Password>
# or
mvn --ep <Password>

And save it in the settings.xml file.

<settings>
...
  <servers>
...
    <server>
      <id>my.server</id>
      <username>foo</username>
      <password>Oleg reset this password on 2009-03-11, expires on 2009-04-11 {COQLCE6DU6GtcS5P=}</password>
    </server>
...
  </servers>
...
</settings>

Verify that the server id is the same than in your pom.xml

In the deploy phase, you distribute the artifacts (jar, site, …) on remote server (or repository). The repository id must then correspond to the server id

Example:

<distributionManagement>
        <repository>
            <id>my.server</id>
            <name>Bytle Remote</name>
            <url>scp://ftp.bytle.net:22</url>
        </repository>
    </distributionManagement>

Documentation / Reference

Support

Given final block not properly padded

[ERROR] Error executing Maven.
[ERROR] javax.crypto.BadPaddingException: Given final block not properly padded
[ERROR] Caused by: Given final block not properly padded

There is a lot of chance that your settings-security.xml file was not saved or is not correct.