Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagexml
titleApache Repo Settings
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <servers>
    <!-- Apache Repo Settings -->
    <server>
        <id>apache.snapshots.https</id>
        <username>{user-id}</username>
        <password>{user-pass}</password>
    </server>
    <server>
        <id>apache.releases.https</id>
        <username>{user-id}</username>
        <password>{user-pass}</password>
    </server>
  </servers>
</settings>


Warning

For security reasons, please refrain from adding your password in plain text here!
Maven provides a secure way to input passwords through encryption.
To understand how this works, refer to the information box below.


Expand
titleSecure password handling in maven
  1. Run mvn --encrypt-master-password
    Maven will ask you to prompt a master password that is used to encrypt all passwords handled/used by Maven.
    Once done, it prints the encrypted master password. Please copy the entire password (including braces!!).

  2. Create a settings-security.xml
    Create the file ${user.home}/.m2/settings-security.xml with the following content:

    <settingsSecurity>
    <master>[your-password-with-braces]</master>
    </settingsSecurity>

  3. Encrypt your Apache password
    Run mvn --encrypt-password
    Enter your password
    Copy the returned password (again including braces) and add it to the settings.xml as displayed above



This tells maven to use above credentials as soon as a repository with the id apache.snapshots.https or apache.releases.https is being used. For a release all you need is the releases repo, but it is good to have the other in place as it enables you to also deploy SNAPSHOTs from your system. There repos are defined in the apache parent pom and is identical for all Apache projects.

...