elharo commented on code in PR #11702:
URL: https://github.com/apache/maven/pull/11702#discussion_r2827919734
##########
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.
- *
- * 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.
- */
- if (!sourceContext.hasSources(Language.SCRIPT,
ProjectScope.MAIN)) {
+ Source directory handling depends on project type and
<sources> configuration:
+
+ 1. CLASSIC projects (no <sources>):
+ - All legacy directories are used
+
+ 2. MODULAR projects (have <module> in <sources>):
+ - ALL legacy directories are rejected (cannot dispatch
between modules)
Review Comment:
what does rejected mean? I think you need to be clear that the build simply
fails or that an exception is thrown or whatever.
##########
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.
- *
- * 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.
- */
- if (!sourceContext.hasSources(Language.SCRIPT,
ProjectScope.MAIN)) {
+ Source directory handling depends on project type and
<sources> configuration:
+
+ 1. CLASSIC projects (no <sources>):
+ - All legacy directories are used
+
+ 2. MODULAR projects (have <module> in <sources>):
+ - ALL legacy directories are rejected (cannot dispatch
between modules)
+ - Physical presence of default directories
(src/main/java) also triggers ERROR
Review Comment:
triggers ERROR --> ????
what does this actually mean? Are you saying the build fails? an exception
is thrown? some error handler is invoked? Be explicit and direct.
##########
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.
- *
- * 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.
- */
- if (!sourceContext.hasSources(Language.SCRIPT,
ProjectScope.MAIN)) {
+ Source directory handling depends on project type and
<sources> configuration:
+
+ 1. CLASSIC projects (no <sources>):
+ - All legacy directories are used
+
+ 2. MODULAR projects (have <module> in <sources>):
+ - ALL legacy directories are rejected (cannot dispatch
between modules)
+ - Physical presence of default directories
(src/main/java) also triggers ERROR
+
+ 3. NON-MODULAR projects with <sources>:
+ - Explicit legacy directories (differ from default) are
always rejected
Review Comment:
ditto
--
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]