ascheman opened a new pull request, #3395: URL: https://github.com/apache/maven-surefire/pull/3395
This is the follow-up to #3392 announced there and in #3090 — it is **stacked on #3392** and stays a draft until #3392 lands (only the last three commits are new). ## What this changes When maven-compiler-plugin 4.x writes the `module-info-patch.args` handoff file, surefire now treats it as the single source of truth for the forked JVM: * The file's directives are passed through **verbatim** (previously `--add-reads`/`--add-modules` were filtered out and replaced by generated fallbacks). * Surefire's auto-generated `--add-reads <module>=ALL-UNNAMED` and `--add-modules ALL-MODULE-PATH` are gone in this case; they remain as fallback when no handoff file is present (behavior without the file is unchanged). * Precondition for the verbatim pass-through: the modules listed by the file's `add-modules` (the test-scope dependencies, e.g. the JUnit engine) become **named modules on the module path**. Surefire moves their classpath elements over, together with their transitive `requires` closure, every classpath element requiring one of the moved modules (they must not be split across the named/unnamed worlds), and an explicit resolution root per moved module. * `--add-opens` for reflective test access now targets `ALL-UNNAMED` plus the moved named modules, and is generated on the plugin side, where the moved module closure is known. This addresses the review discussion on #3392 (@desruisseaux): `module-info-patch.maven` is used exactly as-is, tests run with the same module options as the test compilation. ## Verification * Unit: `maven-surefire-common` 857/857 green. * New IT `Surefire3090TestDepsOnModulePathIT`: asserts **behaviorally** that `Test.class.getModule()` is the named module `org.junit.jupiter.api` (fails when the engine is left on the classpath), that whitebox access to a non-exported package keeps working, and that the moved module closure is logged. Green under Maven 4.0.0-rc-5, skipped under Maven 3. * Existing ITs: green on Maven 3.10.0-rc-1 (fallback byte-identical) and 4.0.0-rc-5. * Acceptance: the jigsaw `example_test/m4` project (1/1) and the Vidocq `champollion-json` pilot (3 modules in one POM, **602/602 tests**) run zero-config under the enforced module system. Fixes #3090. --- 🤖 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
