Skip to content
Latchkey

Leiningen "Retrieving ... from clojars" hang or timeout in CI

Leiningen prints one "Retrieving ..." line per artifact while it downloads the whole dependency tree. On a cold ~/.m2 cache with hundreds of transitive jars, this can run for minutes and appear to hang until the job times out.

What this error means

The log shows a long stream of "Retrieving GROUP/ARTIFACT/... from clojars" lines and then stops making progress, or the job is killed at the CI step timeout.

lein
Retrieving org/clojure/clojure/1.11.1/clojure-1.11.1.pom from clojars
Retrieving org/clojure/spec.alpha/0.3.218/spec.alpha-0.3.218.jar from central
Retrieving ring/ring-core/1.11.0/ring-core-1.11.0.jar from clojars
... (no further output; step killed after timeout)

Common causes

A cold Maven cache on every run

Without a restored ~/.m2/repository, Leiningen re-downloads the full transitive dependency set from clojars and central each build.

A slow or congested link to the repository

A busy runner network or a distant clojars mirror makes each transfer slow, and hundreds of them add up to a stall.

How to fix it

Cache the Maven repository between runs

Persist ~/.m2/repository keyed on the dependency files so a warm cache skips almost all downloads.

.github/workflows/ci.yml
- uses: actions/cache@v4
  with:
    path: ~/.m2/repository
    key: m2-${{ hashFiles('project.clj') }}

Prefetch dependencies in a dedicated step

Resolve dependencies once, separately from the test step, so the download time is isolated and visible.

Terminal
lein deps

How to prevent it

  • Always cache ~/.m2/repository in CI to avoid cold downloads.
  • Split dependency resolution into its own step for clearer timings.
  • Use a nearby Maven mirror when clojars latency is high.

Frequently asked questions

What causes ""Retrieving ... from clojars" hang"?
Without a restored ~/.m2/repository, Leiningen re-downloads the full transitive dependency set from clojars and central each build.
How do I fix "Retrieving ... from clojars" hang?
Persist ~/.m2/repository keyed on the dependency files so a warm cache skips almost all downloads.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card