Error Knowledge Base MAVEN COULD_NOT_TRANSFER_ARTIFACT

Could not transfer artifact ...: transfer failed

Maven attempted to download an artifact or metadata from a repository, but the HTTP(S) transfer failed.

Affected versions: All supported Apache Maven versions.

What This Error Means

Maven attempted to download an artifact or metadata from a repository, but the HTTP(S) transfer failed.

How to Fix It

  1. Identify the exact repository host and URL Maven is trying to reach (copy it from the error line).
  2. If you are behind a corporate proxy, configure it in ~/.m2/settings.xml under <proxies> and re-run the build.
  3. If the error is TLS-related, fix certificate trust for the JDK running Maven (import the corporate/root CA), then retry.
  4. Force Maven to retry metadata/artifacts once: mvn -U -DskipTests package.
  5. If your repository is self-hosted, check repository health (HTTP status, storage, TLS cert validity) and try again.
  6. Re-run with debug logs if you still can't see the root cause: mvn -X -DskipTests package.

Why It Happens

  • The repository host is down or temporarily unreachable.
  • A firewall/VPN/proxy blocks Maven from reaching the repository (or performs TLS interception without a trusted CA).
  • DNS resolution fails for the repository hostname.
  • The connection is being reset or timing out (unstable network, packet loss, overloaded proxy).
  • Maven is running in offline mode (-o) and cannot refresh missing artifacts.

How to Verify

  1. Re-run the original Maven goal and confirm artifacts/metadata are downloaded successfully.
  2. Confirm the artifact now exists in the local repository under ~/.m2/repository/.

Manual network and repository checks

  1. Copy the repository URL from the error output and test basic reachability (DNS + TCP + TLS).
  2. Check whether Maven is configured with a proxy: mvn -q help:effective-settings (look for <proxies>).
  3. Run once with full debug output to see the exact URLs and transports being used: mvn -X -DskipTests package.
  4. If the failure is intermittent, retry the same build on a stable network and compare results.

Common CLI Output

[ERROR] Could not transfer artifact org.example:lib:jar:1.2.3 from/to central (https://repo.maven.apache.org/maven2): transfer failed for https://repo.maven.apache.org/maven2/org/example/lib/1.2.3/lib-1.2.3.jar
[ERROR] Could not transfer metadata org.example:lib/maven-metadata.xml from/to internal (https://repo.example.com/maven): transfer failed for https://repo.example.com/maven/org/example/lib/maven-metadata.xml

How Maven downloads artifacts

  1. Maven downloads artifacts (and metadata like maven-metadata.xml) over HTTP(S) from your configured repositories.
  2. Network errors, proxies, TLS inspection, DNS failures, or repository outages can cause transfers to fail even when coordinates are correct.

Prevention Tips

  • Use a local repository manager proxy to reduce network dependency on upstream repositories.
  • Keep proxy and mirror configuration consistent across developer and CI environments.
  • Avoid mixing multiple repository URLs across projects, prefer one mirrored endpoint.

Where This Can Be Triggered

github.com/apache/maven/blob/maven-3.9.11/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7128BlockExternalHttpReactorTest.java

Maven's integration tests assert the exact "Could not transfer artifact ..." output when an HTTP repository is blocked (MNG-7128). - GitHub

verifier.verifyTextInLog( "[ERROR] Failed to execute goal on project http-repository-in-pom: "
        + "Could not resolve dependencies for project org.apache.maven.its.mng7128:http-repository-in-pom:jar:1.0: "
        + "Failed to collect dependencies at junit:junit:jar:1.3: "
        + "Failed to read artifact descriptor for junit:junit:jar:1.3: "
        + "Could not transfer artifact junit:junit:pom:1.3 from/to maven-default-http-blocker (http://0.0.0.0/): "
        + "Blocked mirror for repositories: [insecure-http-repo (http://repo.maven.apache.org/, default, releases+snapshots)]" );

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

Join our mailing list