Repository navigation
fix: create the CDS archive folder before running a jar with --cds - #2818
Open
arsalankhan786777 wants to merge 1 commit into
Open
arsalankhan786777 wants to merge 1 commit into
arsalankhan786777 wants to merge 1 commit into
Conversation
A jar file or Maven coordinate is not built, so nothing created the cache folder that -XX:ArchiveClassesAtExit points into. The JVM could not write the archive and every run ended with exit code 1. Fixes jbangdev#2816 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
|
No actionable comments were generated in the recent review. Walkthrough
Severity of issue fixed: Medium Merge Risk:
|
maxandersen
approved these changes
Dec 4, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With
--cdson a jar file or a Maven coordinate, every run printed the program's output, then[error][cds] Unable to create shared archive fileand ended with exit code 1. Nothing is built for these inputs, so the cache folder that-XX:ArchiveClassesAtExitpoints into was never created.Fix.
JarCmdGeneratornow creates the archive's parent folder before adding-XX:ArchiveClassesAtExit.Tests. I added
TestRun.testCDSCreatesArchiveFolderForJar, which generates the command forhellojar.jarwith--cdsand checks that the archive folder exists. It is skipped on Java versions before 13.Written with Claude Code (AI); tested locally with the following on Windows 11, with JDK 21 as the test JDK:
./gradlew test --tests dev.jbang.cli.TestRun.testCDSCreatesArchiveFolderForJar -PtestJavaVersion=21: fails without the fix, passes with it../gradlew formatCheck: passes../gradlew test -PtestJavaVersion=21: 1122 tests, 25 failed, 52 skipped. Running the classes with failures (TestApp,TestEdit,TestEditLocate,TestEditWithPom,TestEditWithPackage,TestRun,TestSkill,TestSourcesMultipleSomeMissingFiles) without this change gives the same 25 failing test names../gradlew installDist),jbang --verbose --cds hello.jarrun twice: before, both runs exit 1 with the error above; after, both exit 0, the first writes the archive and the second uses it.com.github.lalyos:jfiglet:0.0.9: both exit 0, the second uses the archive.Not run: integration tests, and the unit tests on the default Java 11 test JDK.
Fixes #2816
🤖 Generated with Claude Code