Skip to content
Latchkey

clj "Error building classpath. Could not find artifact" in CI

The Clojure CLI (clj/clojure) builds a classpath from deps.edn and could not resolve one Maven coordinate. Like Leiningen, it queries central and clojars by default, so a missing or misnamed coordinate stops classpath construction.

What this error means

A clj or clojure command fails immediately with "Error building classpath. Could not find artifact GROUP:ARTIFACT:VERSION in central (or clojars)".

clj
Error building classpath. Could not find artifact org.example/widgets:jar:9.9.9 in central (https://repo1.maven.org/maven2/)

Common causes

A wrong or unpublished coordinate in deps.edn

The :mvn/version for a dependency in :deps points at a version that does not exist, or the group/artifact symbol is misspelled.

A private repository not declared in :mvn/repos

The dependency lives in a private Maven repo, but deps.edn does not list it under :mvn/repos, so tools.deps never queries it.

How to fix it

Fix the coordinate in deps.edn

  1. Confirm the real coordinate on Clojars or Maven Central.
  2. Correct the :mvn/version (or the group/artifact key) in :deps.
  3. Run clojure -P to prepare and verify the classpath resolves.
deps.edn
{:deps {org.clojure/clojure {:mvn/version "1.11.1"}
        org.example/widgets {:mvn/version "1.4.0"}}}

Declare the private Maven repo

Add the hosting repository so tools.deps can resolve private coordinates.

deps.edn
{:mvn/repos {"internal" {:url "https://maven.internal.example.com/repo"}}}

How to prevent it

  • Verify coordinates against the index before committing deps.edn.
  • Declare all non-default Maven repos under :mvn/repos.
  • Cache ~/.m2/repository and .cpcache so resolution is not repeated.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →