Skip to content
Latchkey

Maven "The following artifacts could not be resolved" - Fix in CI

Maven aggregated every artifact it failed to fetch into one list. The detail after the colon names each missing groupId:artifactId:version - they were never published, live on an undeclared repo, or are sibling modules not yet built.

What this error means

Resolution ends with Could not resolve dependencies for project ...: The following artifacts could not be resolved: <a>, <b>, ... plus a reason like "not found" or "transfer failed" for each.

mvn output
[ERROR] Failed to execute goal on project app: Could not resolve dependencies
for project com.example:app:jar:1.0.0: The following artifacts could not be
resolved: com.example:core:jar:1.0.0 (absent), com.example:util:jar:1.0.0 (absent):
Could not find artifact com.example:core:jar:1.0.0 in central

Common causes

Sibling modules not built into the local repo

In a multi-module build, depending on com.example:core requires core to be in the reactor or already installed. Building one module alone leaves the siblings unresolved.

Artifacts missing or on an undeclared repo

Each listed artifact was never published, or lives on a private repo Maven is not configured for, so every one in the list fails to resolve.

How to fix it

Build sibling modules together with -am

Build the target module plus the upstream modules it needs in one reactor.

Terminal
mvn -B -pl :app -am install
# -am ("also make") builds com.example:core and :util first

Declare the repo or force a re-resolve

  1. For external artifacts, declare the hosting repository so each resolves.
  2. Run mvn -U to clear cached negatives after publishing the missing artifacts.
  3. Use mvn dependency:tree to confirm which configuration pulls each missing item.

How to prevent it

  • Build multi-module projects from the aggregator with -am when targeting one module.
  • Install or deploy shared modules before building dependents in isolation.
  • Declare every repository hosting the listed artifacts.

Related guides

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