desruisseaux commented on code in PR #3392:
URL: https://github.com/apache/maven-surefire/pull/3392#discussion_r3613727067
##########
maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfiguration.java:
##########
@@ -224,4 +240,76 @@ File createArgsFile(
return surefireArgs;
}
}
+
+ /**
+ * Searches for module-info-patch.args generated by maven-compiler-plugin
4.x.
+ * The file is expected at {@code
target/test-classes/META-INF/maven/module-info-patch.args}
+ * or within a module subdirectory at
+ * {@code
target/test-classes/<module>/META-INF/maven/module-info-patch.args}.
+ *
+ * @param patchFile the test classes directory (may be the module
subdirectory)
+ * @return the module-info-patch.args file, or null if not found
+ */
+ @Nullable
+ private static File findModuleInfoPatchArgs(File patchFile) {
+ // Direct location:
target/test-classes/<module>/META-INF/maven/module-info-patch.args
+ File argsFile = new File(patchFile,
"META-INF/maven/module-info-patch.args");
+ if (argsFile.isFile()) {
+ return argsFile;
+ }
+ // Parent location:
target/test-classes/META-INF/maven/module-info-patch.args
+ File parent = patchFile.getParentFile();
+ if (parent != null) {
+ argsFile = new File(parent,
"META-INF/maven/module-info-patch.args");
+ if (argsFile.isFile()) {
+ return argsFile;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Reads the module-info-patch.args file and appends its directives (e.g.
--add-exports,
+ * --add-opens) to the args builder. Exceptions are --add-reads and
--add-modules, which
+ * are skipped: they may reference named modules that surefire places on
the classpath
+ * rather than the module path. Surefire appends its own
+ * {@code --add-reads <module>=ALL-UNNAMED} instead, and {@code
--add-modules
+ * ALL-MODULE-PATH} is generated by the caller.
Review Comment:
Reminder (already discussed), this exception should be removed after the
problem of dependencies put on the class-path instead of module-path is
resolved.
--
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]