Scrivio Interview library
DebuggingIntermediate7 min read · updated 12 November 2026

CI builds fail intermittently with 'Could not transfer artifact ... from/to central: status code 429' and some builds pick up a SNAPSHOT another team deployed an hour ago. What changes do you make?

The 429 status means Maven Central is rate limiting our CI, so we route all traffic through a repository manager mirror that caches artifacts, and cache ~/.m2/repository between CI runs. The surprise SNAPSHOT happens because a SNAPSHOT dependency resolves to whatever was deployed most recently, so builds are not reproducible; we depend on released versions, set the snapshot update policy on purpose, and fail release builds that use snapshots with the Enforcer rule requireReleaseDeps. Running Maven with -B and --no-transfer-progress keeps the logs readable while we debug.

Why this question is asked

These two symptoms look unrelated, but they have the same root: the CI builds talk to remote repositories more, and less predictably, than they should. One problem makes builds fail randomly; the other makes them pass or fail depending on what another team did an hour ago. Interviewers ask this because fixing it needs an understanding of how Maven resolves artifacts and what a SNAPSHOT really is. In this answer, we will read the 429 error, fix the traffic with a mirror and a cache, recap how SNAPSHOT resolution works, make builds reproducible, and tidy the logs.

1Reading the 429 Error

HTTP status 429 means Too Many Requests. The server is telling us we have sent more requests than it allows in a period of time. Maven Central is a free public service used by the whole world, and it limits heavy users. A CI system that starts fifty fresh agents an hour, each downloading a few hundred artifacts from scratch, looks exactly like a heavy user.

Text
[ERROR] Failed to execute goal on project orders: Could not resolve dependencies ...
[ERROR] Could not transfer artifact com.fasterxml.jackson.core:jackson-databind:jar:2.19.0
from/to central (https://repo.maven.apache.org/maven2): status code: 429, reason phrase: Too Many Requests

Notice the words 'from/to central'. The build is going straight to Central, with no company repository in between. And it is intermittent because it depends on how many builds ran recently from the same network address.

2Fix the Traffic: A Mirror and a Cache

The main fix is to stop CI from talking to Central directly. We point every build at the company repository manager, Nexus or Artifactory, with a mirror in the settings.xml that CI uses. The repository manager downloads each artifact from Central once, keeps it, and serves it to every later build from its cache. Central sees one request instead of thousands, and our builds no longer depend on Central being reachable.

XML
<!-- ci-settings.xml, used with: mvn -s ci-settings.xml ... -->
<mirrors>
<mirror>
<id>company</id>
<mirrorOf>*</mirrorOf>
<url>https://repo.acme.example/repository/maven-all/</url>
</mirror>
</mirrors>

The second fix is to avoid downloading at all when nothing changed. Most CI systems can cache a directory between runs; we cache ~/.m2/repository with a key based on a hash of all pom.xml files, so the cache is reused until dependencies change. If the repository manager runs close to the runners, in the same data centre or cloud region, a cold build is fast enough that the cache becomes a nice extra rather than a must.

3A Quick Recap of How SNAPSHOT Resolution Works

A SNAPSHOT version, such as 1.4.0-SNAPSHOT, means 'the latest development build of 1.4.0'. Each time a team runs mvn deploy on a SNAPSHOT, the repository stores a new copy with a timestamp and build number, such as 1.4.0-20261104.153012-7, and updates a metadata file saying which copy is the latest.

When our build depends on 1.4.0-SNAPSHOT, Maven reads that metadata and downloads the newest copy. How often it checks is controlled by the repository's updatePolicy: daily by default, or always, never, or interval:N minutes. On CI, with a fresh local repository, Maven checks every time. So if another team deployed a new SNAPSHOT an hour ago, our build picks it up, even though nothing in our repository changed.

Step throughWhy our build changed without a commit
Team BRepo managerOur CI
deploy payments-client 1.4.0-SNAPSHOT (build 6)
09:00 resolve 1.4.0-SNAPSHOT
build 6: tests pass
10:00 deploy build 7 with a breaking change
11:00 resolve 1.4.0-SNAPSHOT again
build 7: tests fail on the same commit

6 messages in order. Play them, or step through them one at a time.

Same commit, different result, because the SNAPSHOT moved.

4Make Builds Reproducible

The rule is that a build should produce the same result from the same commit. A SNAPSHOT dependency breaks that rule by design. So for anything that matters, our services depend on released versions of other teams' libraries, such as 1.4.0, which never change once published. If team B needs to share work in progress, they release a 1.4.0-rc1 or a regular minor version; releasing is cheap when the pipeline is automated.

For a short-lived integration, for example two teams testing a change together this week, we can pin a timestamped snapshot instead of the moving name. Depending on 1.4.0-20261104.153012-7 always gives exactly build 7. We remove it as soon as the release exists.

We also set updatePolicy deliberately in the repository definitions: never for release repositories, since releases do not change, and for snapshot repositories whatever the team really wants, often daily on developer machines. And release builds must never contain snapshots. The Enforcer plugin's requireReleaseDeps rule fails the build if any dependency is a SNAPSHOT.

XML
<!-- in the release profile of the corporate parent -->
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>no-snapshots-in-releases</id>
<goals><goal>enforce</goal></goals>
<configuration>
<rules>
<requireReleaseDeps>
<message>Release builds must not depend on SNAPSHOT versions</message>
</requireReleaseDeps>
</rules>
</configuration>
</execution>
</executions>
</plugin>
# [ERROR] Rule 0: RequireReleaseDeps failed ...
# Release builds must not depend on SNAPSHOT versions
# Found Banned Dependency: com.acme:payments-client:jar:1.4.0-SNAPSHOT

5Keep the CI Logs Readable

While we fix these problems, we will read a lot of CI logs, and by default Maven fills them with download progress lines. Two options help. -B, batch mode, tells Maven it is not running interactively, so it never waits for input and disables coloured output that looks like noise in plain logs. --no-transfer-progress, or -ntp, removes the per-artifact progress lines while still printing errors. A full CI command then looks like this.

Shell
$ mvn -B -ntp -s ci-settings.xml verify
# Downloading lines are gone; failures such as 'status code: 429' are still printed

After the changes, we check the logs again: every download should now come from the company mirror, and the 429 errors should disappear. If any request still goes to central, some settings file or POM is bypassing the mirror, which mvn help:effective-settings helps us find.

6Putting the Changes Together

The table sums up each symptom, its cause and the change that removes it.

Symptoms, causes and changes
SymptomCauseChange
Intermittent 429 from centralEvery agent downloads from CentralMirror * to the repository manager
Slow cold buildsEmpty local repository each runCache ~/.m2/repository by POM hash
New SNAPSHOT appears unannouncedSNAPSHOT resolves to the latest deployDepend on releases; pin timestamps briefly
Snapshots in a releaseNo check in the release buildEnforcer requireReleaseDeps
Logs hard to readInteractive output and progress lines-B and --no-transfer-progress

7Follow-up questions

Is it enough to only cache ~/.m2 and skip the repository manager?

It helps, but it is not enough. The cache is empty whenever the key changes, on a new branch or after a dependency update, and then the agent goes to Central again. Different runners may not share caches. And without a repository manager we have no place to scan artifacts or host internal ones. The mirror fixes the cause; the cache is an optimisation on top.

What does mvn -U do, and should CI use it?

-U forces Maven to check remote repositories for updated SNAPSHOTs and for previously failed downloads, ignoring the update policy. On CI with a fresh local repository it changes little. It is useful on a developer machine after a missing artifact was published, because Maven otherwise remembers the failure until the update interval passes.

Why not let teams depend on each other's SNAPSHOTs on the main branch?

Because then the result of our main branch build depends on another team's last deploy, which we do not control and cannot reproduce. A failure might be their bug, appear and disappear, and block our release. Depending on released versions makes every upgrade a visible change in our POM that we can test and revert.

8Conclusion

In this answer, we saw that the 429 errors come from CI downloading straight from Maven Central, and that a repository manager mirror plus a cached local repository removes them. The surprise SNAPSHOT comes from SNAPSHOT versions resolving to the latest deploy, so we depend on releases, pin timestamped snapshots only briefly, set updatePolicy on purpose and use requireReleaseDeps in release builds. Batch mode and --no-transfer-progress keep the logs readable.

What to say in the interviewAbout 90 seconds aloud

Open with

The 429 is Maven Central rate limiting us. The log says from/to central, so CI is going straight to Central, and with many fresh agents each downloading hundreds of artifacts we look like a heavy user.

Then, if they want more

I would route all traffic through the company repository manager with a mirror, mirrorOf star, in the settings file CI uses, so Central is hit once per artifact and everything else comes from the cache. I would also cache ~/.m2/repository between runs, keyed on a hash of the POMs, or make sure the repository manager is close to the runners.

The SNAPSHOT problem is a reproducibility problem. A SNAPSHOT version resolves to the latest deployed build, so when another team deploys, our build changes without any commit of ours. For services I would depend on released versions only.

For a short integration between two teams, we can pin a timestamped snapshot, which is fixed, and remove it once there is a release. I would set the snapshot repository's updatePolicy deliberately and add the Enforcer requireReleaseDeps rule to release builds so a SNAPSHOT can never ship.

And while I am in there, I would run CI with -B and --no-transfer-progress, so the logs show errors instead of thousands of download lines, and check that every download now comes from the mirror.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
Apache Maven guides
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "CI builds fail intermittently with 'Could not transfer artifact ... from/to central...": https://scrivio-interview-library.netlify.app/java/maven/52e87b7514/