ascheman commented on code in PR #11702:
URL: https://github.com/apache/maven/pull/11702#discussion_r2793446933


##########
impl/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java:
##########
@@ -693,27 +693,27 @@ private void initProject(MavenProject project, 
ModelBuilderResult result) {
 
                 /*
                  * `sourceDirectory`, `testSourceDirectory` and 
`scriptSourceDirectory`
-                 * are ignored if the POM file contains at least one enabled 
<source> element
+                 * are not used if the POM file contains at least one enabled 
<source> element

Review Comment:
   Looking at this more closely, I think we've uncovered an inconsistency:
   
   **Current behavior:**
   - **Resources** (`<resources>`/`<testResources>`): ERROR for **both** 
modular and classic projects when `<sources>` conflicts with legacy config 
(handled in `SourceHandlingContext`)
   - **Source directories** (`<sourceDirectory>`/`<testSourceDirectory>`): 
ERROR only for **modular** projects, silently skipped for classic projects
   
   **AC8** specifically scopes the error behavior to modular projects:
   > "Legacy directories trigger ERROR in modular projects"
   
   This leaves classic projects with `<sources>` in an inconsistent state - 
their legacy resources cause an error, but legacy source directories are 
silently ignored.
   
   **Proposal:** If @desruisseaux and @elharo agree, we could add:
   
   **AC9**: For classic (non-modular) projects, legacy `<sourceDirectory>` and 
`<testSourceDirectory>` also trigger an ERROR when `<sources>` elements are 
configured for the same scope/language. This ensures consistency with resource 
handling and prevents silent configuration loss.
   
   Should I create a follow-up issue for this, or would you prefer to extend 
the current PR?



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