Maven "Failed to read artifact descriptor" - Fix in CI
To resolve a dependency, Maven first reads its POM (the "artifact descriptor"). This error means it could not fetch or parse that POM - the descriptor is missing, corrupt in ~/.m2, or its own parent/repo is unreachable.
What this error means
Resolution fails early with Failed to read artifact descriptor for <groupId>:<artifactId>:<packaging>:<version>, often followed by a Could not transfer or Could not find cause for the dependency’s POM.
[ERROR] Failed to execute goal on project app: Could not resolve dependencies
for project com.example:app:jar:1.0.0:
Failed to read artifact descriptor for com.example:lib:jar:2.3.1:
Could not transfer artifact com.example:lib:pom:2.3.1 from/to central: Connection resetCommon causes
Corrupt or truncated POM in the local repo
An interrupted download can leave a half-written .pom in ~/.m2. Maven then cannot parse the descriptor and fails before downloading the jar.
Dependency POM or its parent is unreachable
The descriptor references a parent POM or a repository Maven cannot reach. The jar might exist, but without a readable POM resolution stops.
How to fix it
Purge the bad descriptor and re-resolve
Remove the offending path from the local repo and force a fresh fetch of the POM.
rm -rf ~/.m2/repository/com/example/lib/2.3.1
mvn -U -B dependency:resolveEnsure the descriptor’s repo and parent resolve
- Run
mvn -X dependency:resolveto see exactly which POM (and which repo) failed. - If the descriptor’s parent lives on a private repo, declare that repository.
- For a transient transfer error, enable wagon retries so a single blip does not fail the read.
How to prevent it
- Avoid persisting
~/.m2from interrupted/OOM-killed runs that can truncate POMs. - Declare every repository a dependency descriptor needs, including for its parent.
- Set
-Dmaven.wagon.http.retryHandler.countso a transient POM transfer retries.