build: make surefire enableProcessChecker overridable for Windows 11 compatibility.#1968
build: make surefire enableProcessChecker overridable for Windows 11 compatibility.#1968anmol-saxena-14 wants to merge 1 commit into
Conversation
| <reuseForks>false</reuseForks> | ||
| <forkedProcessTimeoutInSeconds>${surefire.forkedProcessTimeout}</forkedProcessTimeoutInSeconds> | ||
| <enableProcessChecker>all</enableProcessChecker> | ||
| <enableProcessChecker>${surefire.enableProcessChecker}</enableProcessChecker> |
There was a problem hiding this comment.
It's already the case right?
My understanding is that you are using just a Maven property instead of having the setting all inline (in the test profile).
Can you elaborate?
There was a problem hiding this comment.
Yes, that is exactly what this change does.
Before, the value was hardcoded inline in the surefire plugin configuration:
<enableProcessChecker>all</enableProcessChecker>
After, it is driven by a Maven property with all as the default:
<!-- in <properties> -->
<surefire.enableProcessChecker>all</surefire.enableProcessChecker>
<!-- in surefire plugin config -->
<enableProcessChecker>${surefire.enableProcessChecker}</enableProcessChecker>
The default value is unchanged so CI and all existing environments behave identically. The only difference is that a developer on Windows 11 (where wmic is no longer available) can now override it on the command line without patching the pom:
mvn test -Dsurefire.enableProcessChecker=ping
This change follows the same pattern already used in this pom for surefire.forkedProcessTimeout and surefire.argLine.
## Problem
Surefire 3.x uses
wmicto periodically check whether the parent Maven process is still alive.wmicwas removed in Windows 11 22H2, so the check always fails — the forked test, JVM concludes the parent has died and calls System.exit(1) before any test runs.Symptoms on Windows 11:
[ERROR] The forked VM terminated without properly saying goodbye.
[ERROR] Process Exit Code: 1
## Change
Extract
enableProcessCheckerinto an overridable property with defaultall. Windows 11 developers can now run tests using:mvn test -Dsurefire.enableProcessChecker=ping.No behaviour change for CI or any other environment.
Note:
pinguses the stdin pipe to detect parent-process death rather thanwmic, and works correctly on all platforms.