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


##########
impl/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java:
##########
@@ -692,49 +692,102 @@ private void initProject(MavenProject project, 
ModelBuilderResult result) {
                 }
 
                 /*
-                 * `sourceDirectory`, `testSourceDirectory` and 
`scriptSourceDirectory`
-                 * are ignored if the POM file contains at least one enabled 
<source> element
-                 * for the corresponding scope and language. This rule exists 
because
-                 * Maven provides default values for those elements which may 
conflict
-                 * with user's configuration.
+                 * Source directory handling depends on project type and 
<sources> configuration:
                  *
-                 * Additionally, for modular projects, legacy directories are 
unconditionally
-                 * ignored because it is not clear how to dispatch their 
content between
-                 * different modules. A warning is emitted if these properties 
are explicitly set.
+                 * 1. CLASSIC projects (no <sources>):
+                 *    - All legacy directories are used
+                 *
+                 * 2. MODULAR projects (have <module> in <sources>):
+                 *    - ALL legacy directories are rejected (can't dispatch 
between modules)
+                 *    - Physical presence of default directories 
(src/main/java) also triggers ERROR

Review Comment:
   This is useful information. I will repeat that this should be in the docs. I 
still don't have a full picture in my head of what's in the pom.xml and how 
that now relates what files are where in the project. I don't think we need to 
think about subprojects just yet. If the docs explained how a single project 
with two named modules and code in the unnamed module needs to be set up, that 
probably covers 90% of the complexity. Part of this might be the JPMS version 
of 
   
   
https://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html
   
   Does this exist yet?
   
   The other part would be the JPMS version of the Maven POM reference: 
https://maven.apache.org/pom.html
   
   Does this exist yet? 



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