gnodet commented on PR #3392:
URL: https://github.com/apache/maven-surefire/pull/3392#issuecomment-7394443590

   _Claude Code on behalf of Guillaume Nodet_
   
   ## Critical Issue #4: Module Path Conflict Detection Missing
   
   **Location:** `AbstractSurefireMojo.java` line ~2278 in 
`resolveModulePathSplitForAllModules()`
   
   **Problem:**
   The code unions module path requirements from all modules:
   ```java
   for (JavaModuleDescriptor descriptor : allDescriptors) {
       ResolvePathsResult<String> result = 
resolveTestClasspath(testClasspathElements, descriptor, javaHome);
       modulepathElements.addAll(result.getModulepathElements().keySet());
       classpathElements.addAll(result.getClasspathElements());
   }
   classpathElements.removeAll(modulepathElements);  // modulepath wins
   ```
   
   If Module A requires dependency X on classpath but Module B requires X on 
modulepath, X goes to modulepath for BOTH modules (since the fork has a single 
boot layer).
   
   **Impact:**
   - Module A may fail to find classes in X (looking on classpath, but X is on 
modulepath)
   - Unexpected `ClassNotFoundException` or `NoClassDefFoundError`
   - Subtle behavior changes if X provides services differently depending on 
classpath vs modulepath placement
   
   **Recommendation:**
   1. Detect when modules have conflicting placement requirements
   2. Log a warning that dependencies are being moved from classpath to 
modulepath
   3. Document this as a known limitation of multi-module support (single boot 
layer constraint)
   
   **Example Warning:**
   ```
   [WARNING] Dependency junit-4.13.jar required on classpath by module 
com.example.legacy
   [WARNING] but on modulepath by module com.example.modern - placing on 
modulepath for both.
   [WARNING] This may cause test failures in com.example.legacy.
   ```


-- 
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]

Reply via email to