apache/maven · error · ExitException

Master password encyption is not supported anymore

Error message

Master password encyption is not supported anymore

What it means

The -emp / --encrypt-master-password command was used to produce an obfuscated master password for the settings.xml security infrastructure in Maven 3. Maven 4 removed that mechanism: when the option is present, MavenCli.encryption() prints 'Master password encyption is not supported anymore' (typo intact in source) and throws ExitException(1), terminating the CLI immediately with exit code 1. No build is attempted.

Source

Thrown at compat/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java:980

            for (String jar : extClassPath.split(File.pathSeparator)) {
                File file = ResolveFile.resolveFile(new File(jar), cliRequest.workingDirectory);

                slf4jLogger.debug("  included '{}'", file);

                jars.add(file);
            }
        }

        return jars;
    }

    //
    // This should probably be a separate tool and not be baked into Maven.
    //
    private void encryption(CliRequest cliRequest) throws Exception {
        if (cliRequest.commandLine.hasOption(CLIManager.ENCRYPT_MASTER_PASSWORD)) {
            System.out.println("Master password encyption is not supported anymore");
            throw new ExitException(1);
        } else if (cliRequest.commandLine.hasOption(CLIManager.ENCRYPT_PASSWORD)) {
            String passwd = cliRequest.commandLine.getOptionValue(CLIManager.ENCRYPT_PASSWORD);

            if (passwd == null) {
                Console cons = System.console();
                char[] password = (cons == null) ? null : cons.readPassword("Password: ");
                if (password != null) {
                    // Cipher uses Strings
                    passwd = String.copyValueOf(password);

                    // Sun/Oracle advises to empty the char array
                    java.util.Arrays.fill(password, ' ');
                }
            }
            System.out.println(dispatcher.encrypt(passwd, null));
            throw new ExitException(0);
        }
    }

View on GitHub (pinned to e4093d4e12)

Solutions

  1. Remove the -emp/--encrypt-master-password flag from scripts and docs; Maven 4 cannot generate or use master passwords.
  2. If you rely on settings.xml password encryption, run the encryption step with a Maven 3.9.x distribution (e.g. via mvnd or a pinned maven 3 wrapper) and keep Maven 4 for builds, or migrate off encrypted passwords.
  3. Migrate server credentials to environment-variable substitution in settings.xml (${env.VAR}) or your secret manager / CI credential injection.
  4. If you must keep encrypted passwords long-term, plan a move to an external secrets mechanism, since the removal is intentional and final.

Example fix

# before
mvn --encrypt-master-password

# after (substitute credentials via environment)
# settings.xml:
#   <password>${env.CI_DEPLOY_PASSWORD}</password>
ci-secret-export CI_DEPLOY_PASSWORD=... && mvn deploy
Defensive patterns

Strategy: validation

Validate before calling

# Shell wrapper: fail fast with guidance before Maven runs
if printf '%s\n' "$@" | grep -qE '^(-emp|--encrypt-master-password)$'; then
  echo "ERROR: -emp/--encrypt-master-password was removed in Maven 4." >&2
  echo "Use Maven 3.9.x for encryption tooling or inject secrets via env vars." >&2
  exit 2
fi
exec mvn "$@"

Prevention

When it happens

Trigger: Any invocation carrying -emp or --encrypt-master-password: mvn --encrypt-master-password, mvn -emp, or a shell alias/script wrapping it. The check happens in the encryption() phase, right after option parsing, so even mvn -emp clean on a valid project fails.

Common situations: Upgrading from Maven 3.x to Maven 4 while CI jobs, onboarding docs, or password-management scripts still call mvn -emp to (re)generate the master password. Team wikis documenting the old 'mvn --encrypt-master-password then mvn --encrypt-password' workflow. Note the message is printed to stdout and the process exits 1, which CI treats as a hard failure.

Related errors


AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21). Data as JSON: /api/errors/d977bad153dbbef0. Report an issue: GitHub.