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.
[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 centralCommon 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.
mvn -B -pl :app -am install
# -am ("also make") builds com.example:core and :util firstDeclare the repo or force a re-resolve
- For external artifacts, declare the hosting repository so each resolves.
- Run
mvn -Uto clear cached negatives after publishing the missing artifacts. - Use
mvn dependency:treeto confirm which configuration pulls each missing item.
How to prevent it
- Build multi-module projects from the aggregator with
-amwhen targeting one module. - Install or deploy shared modules before building dependents in isolation.
- Declare every repository hosting the listed artifacts.