Error Knowledge Base MAVEN PROXY_AUTH_REQUIRED_407

407 Proxy Authentication Required

Maven is using an HTTP proxy to reach repositories, but the proxy requires authentication and Maven is not configured with valid proxy credentials.

Affected versions: All supported Apache Maven versions.

What This Error Means

Maven is using an HTTP proxy to reach repositories, but the proxy requires authentication and Maven is not configured with valid proxy credentials.

How to Fix It

  1. Add or update a <proxy> entry in ~/.m2/settings.xml with the correct host, port, protocol, and credentials.
  2. If only one proxy should be active, ensure only one <proxy> has <active>true</active>.
  3. If you have an internal repository manager, add its host to nonProxyHosts so Maven can reach it directly.
  4. Re-run the Maven command. If it still fails, run with debug logs: mvn -X -DskipTests package and confirm the proxy settings being used.

Why It Happens

  • Proxy configuration is missing from settings.xml on the machine running Maven.
  • Proxy username/password is missing or incorrect.
  • The proxy changed (host/port) or credentials were rotated.
  • Maven is unintentionally using a proxy in one environment but not another (different settings files).

How to Verify

  1. Re-run the original Maven goal and confirm Maven can download artifacts without 407 responses.
  2. Confirm at least one new artifact is written to ~/.m2/repository/.

Manual proxy configuration checks

  1. Print effective settings and check <proxies>: mvn -q help:effective-settings.
  2. Confirm the proxy host, port, and protocol match your network requirements (HTTP vs HTTPS proxy).
  3. Confirm nonProxyHosts includes internal repository hosts that should bypass the proxy (if applicable).
  4. Retry with debug logs to confirm Maven is attempting to use the proxy: mvn -X -DskipTests package.

Common CLI Output

[ERROR] Failed to transfer file: https://repo.maven.apache.org/maven2/... Return code is: 407, ReasonPhrase: Proxy Authentication Required.
[ERROR] 407 Proxy Authentication Required

How Maven uses proxies

  1. Maven proxy settings live in ~/.m2/settings.xml under <proxies>.
  2. If a proxy is required for outbound traffic, Maven must be configured with the correct proxy host/port and (if needed) username/password.
  3. If proxy auth is missing or wrong, the proxy responds with 407 and Maven cannot reach repositories.

Prevention Tips

  • Standardize settings.xml distribution for developers and CI so proxy configuration is consistent.
  • Use a repository manager inside the network so external proxy rules affect fewer endpoints.
  • Document required proxy settings (including nonProxyHosts) for build environments.

Where This Can Be Triggered

github.com/apache/maven/blob/maven-3.9.6/maven-core/src/main/java/org/apache/maven/project/DefaultProjectDependenciesResolver.java

HTTP proxy failures (407) are surfaced to Maven as a transfer failure message from the underlying resolver/wagon layer (e.getMessage()). - GitHub

String msg = "Could not resolve dependencies for project " + project.getId() + ": " + e.getMessage();
DependencyResolutionException dex = new DependencyResolutionException(msg, e);
dex.setResult(e.getResult());
throw dex;

Need help or found a mistake? Contact RepoFlow support for questions.

Join our mailing list