Skip to content
Latchkey

Maven "Could not find artifact ... in central" - Fix in CI

Maven looked for a specific artifact on Maven Central and Central does not have it. Usually the version was never published to Central, the artifact lives on a private repo, or - occasionally - a mirror briefly served a 404 for something that is really there.

What this error means

Resolution fails with Could not find artifact <groupId>:<artifactId>:<packaging>:<version> in central (https://repo.maven.apache.org/maven2). The line names the exact coordinates Central could not serve.

mvn output
[ERROR] Failed to execute goal on project app: Could not resolve dependencies
for project com.example:app:jar:1.0.0: Could not find artifact
com.example:internal-lib:jar:3.2.0 in central
(https://repo.maven.apache.org/maven2)

Common causes

Version or artifact not published to Central

The exact version named was never released to Maven Central. A pre-release, an internal build, or a typo in the version means Central has nothing to return.

Artifact lives only on a private/vendor repo

Internal libraries are not on Central. Without the hosting <repository> declared, Maven only queries Central and reports a miss.

Transient miss on a flaky mirror

A pull-through mirror or CDN edge can briefly 404 an artifact that genuinely exists, especially right after publish. The same -U re-resolve then succeeds.

How to fix it

Confirm the artifact really is on Central

Check the coordinates against search.maven.org. If it is internal, it will never be on Central.

Terminal
# does this exact version exist on Central?
curl -sI https://repo.maven.apache.org/maven2/com/example/internal-lib/3.2.0/internal-lib-3.2.0.pom

Declare the private repository that hosts it

Point Maven at the repo that actually holds an internal artifact.

pom.xml
<repositories>
  <repository>
    <id>company-releases</id>
    <url>https://nexus.example.com/repository/maven-releases/</url>
  </repository>
</repositories>

Force a fresh re-resolve for a flaky miss

If the artifact does exist on Central, a -U re-resolve clears a cached negative and a transient mirror 404.

Terminal
mvn -U -B dependency:resolve

How to prevent it

  • Keep internal artifacts behind a declared private repository or mirror.
  • Pin versions that are actually published; avoid referencing un-released builds.
  • Resolve through one pull-through mirror so a public-Central edge miss is absorbed.

Related guides

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