Maven corrupt cached JAR "zip END header not found" in CI
A JAR cached in the local repository is incomplete or corrupt, so the JVM cannot read it as a zip. This typically follows a truncated download that Maven cached anyway, and it persists across runs until the bad file is removed.
What this error means
A compile, plugin, or test step fails with "error in opening zip file" or "zip END header not found" pointing at a JAR under ~/.m2/repository.
mvn output
[ERROR] Failed to execute goal ... on project app:
Error loading class path resource: java.util.zip.ZipException: zip END header not found
at /home/runner/.m2/repository/com/example/lib/2.3.1/lib-2.3.1.jarCommon causes
A truncated download was cached
A download cut short by a network drop was stored in .m2, leaving a partial JAR that is not a valid zip.
A stale cache restored a corrupt entry
A CI cache key restored a .m2 that already contained a damaged artifact, so every run reuses the bad file.
How to fix it
Purge the corrupt artifact and re-download
- Delete the bad artifact from the local repo (or purge it via the plugin).
- Re-run so Maven fetches a fresh, complete copy.
- Confirm the JAR opens (
unzip -t) before caching it again.
Terminal
mvn -B dependency:purge-local-repository -DmanualInclude=com.example:lib
mvn -B verifyValidate checksums on download
Fail fast on a bad transfer instead of caching it by enforcing checksum validation.
Terminal
mvn -B -C verifyHow to prevent it
- Enable strict checksum checks (
-C) so bad downloads fail, not cache. - Avoid caching
.m2entries that failed verification. - Re-download artifacts that ever produced a zip error.
Related guides
Maven "Premature end of Content-Length" transfer in CIFix Maven "Premature end of Content-Length delimited message body" in CI - an artifact download was truncated…
Maven "Could not validate integrity ... checksum" in CIFix Maven "Could not validate integrity of download ... Checksum validation failed, expected X but is Y" in C…
Maven Wrapper "Could not download" distribution in CIFix Maven Wrapper "Error downloading / Could not download maven-x.y.z-bin.zip" in CI - mvnw could not fetch t…