Skip to content

Read jar resources without the JVM jar: cache - #139

Merged
slachiewicz merged 1 commit into
codehaus-plexus:masterfrom
slachiewicz:agent/uncached-jar
Oct 28, 2026
Merged

slachiewicz merged 1 commit into
codehaus-plexus:masterfrom
slachiewicz:agent/uncached-jar

Conversation

@slachiewicz

@slachiewicz slachiewicz commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

JarResourceLoader kept each jar open through a JarFile from the JVM-wide jar: cache and never closed it, so the jar stayed locked on Windows and was read stale once rewritten, for example a build-tools module rebuilt in the same reactor or under mvnd. This is the open JDK bug JDK-8239054. JarHolder now indexes the jar once and reads each resource through its own uncached connection, so nothing stays open between reads.

JarHolder.getPlexusResource(..).getURL() now returns the jar:…!/entry URL; it used to resolve the entry name against the jar file's own URL, which points next to the jar rather than into it.

Verified: JarResourceLoaderTest.readsRewrittenJar fails on master with EOFException: Unexpected end of ZLIB input stream and passes here.

Part of apache/maven#13738.

JarHolder kept a JarFile from the JVM-wide jar: cache open for the life of
the loader, so the jar stayed locked on Windows and was read stale once
rewritten (JDK-8239054). It now indexes the jar once and reads each
resource through its own uncached connection. Do not switch back to a
cached JarURLConnection.
@slachiewicz slachiewicz added the bug Something isn't working label Oct 28, 2026
@slachiewicz
slachiewicz marked this pull request as ready for review October 28, 2026 22:11
@slachiewicz
slachiewicz merged commit a362745 into codehaus-plexus:master Oct 28, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant