You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "gnodet (via GitHub)" <gi...@apache.org> on 2026/06/26 09:55:51 UTC

[PR] Fix mvn.cmd jvm.config read failing silently on Windows CI [maven]

gnodet opened a new pull request, #12378:
URL: https://github.com/apache/maven/pull/12378

   ## Summary
   
   - Replace `for /f` with `set /p` + `<` input redirect to read the JvmConfigParser temp file in `mvn.cmd`
   - `for /f` silently produces no output when the file is briefly locked by Windows Defender real-time scanning, leaving `JVM_CONFIG_MAVEN_OPTS` empty — this is the root cause of `MavenITmng4559SpacesInJvmOptsTest` and `MavenITmng4559MultipleJvmArgsTest` failing intermittently on Windows CI
   - `set /p <file` uses a transient input-redirect open with different sharing flags, making it far less susceptible to lock contention; if the file IS locked, it emits a visible error to stderr rather than failing silently
   - Add a single retry with a brief delay as a safety net for the rare case where `set /p` also hits a lock
   
   ### Background
   
   The `JvmConfigParser.java` + temp file approach was introduced in #11365 to fix special character handling (pipes `|`, `@` symbols, etc.) in `.mvn/jvm.config`. Direct stdout capture via `for /f ... in (\`command\`)` was tried (343b518a) and reverted (7685323d) because cmd.exe's child shell interprets pipe characters in the output — defeating the purpose of the parser.
   
   The current approach (Java writes file → `for /f` reads file) avoids the expansion problem but introduced a silent-failure window: Windows Defender scans newly created files and briefly locks them, and `for /f` silently skips locked files.
   
   CI data from the last two weeks shows this failure hits ~30% of Windows integration test runs on master, always with the same symptom: `expected: <foo bar> but was: <${prop.jvm-opts}>` (the JVM never received the jvm.config properties).
   
   ### Supersedes #12337
   
   This fixes the root cause in `mvn.cmd` itself rather than adding a test-level retry workaround. PR #12337 added inline retries to the test methods — that approach masks the problem for CI but doesn't help end users who hit the same issue running Maven on Windows with a `.mvn/jvm.config` file.
   
   ## Test plan
   
   - [ ] Windows CI integration tests pass (especially `MavenITmng4559SpacesInJvmOptsTest` and `MavenITmng4559MultipleJvmArgsTest`)
   - [ ] Linux/macOS CI unaffected (this code path is Windows-only)
   - [ ] Pipe symbol test (`MavenITgh11363PipeSymbolsInJvmConfigTest`) still passes — `set /p` does not interpret special characters during assignment
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix mvn.cmd jvm.config read failing silently on Windows CI [maven]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #12378:
URL: https://github.com/apache/maven/pull/12378#issuecomment-4816459741

   @gnodet Please assign appropriate label to PR according to the type of change.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix mvn.cmd jvm.config read failing silently on Windows CI [maven]

Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet merged PR #12378:
URL: https://github.com/apache/maven/pull/12378


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org