desruisseaux commented on code in PR #2278:
URL: https://github.com/apache/maven/pull/2278#discussion_r2066615591


##########
api/maven-api-core/src/main/java/org/apache/maven/api/SourceRoot.java:
##########
@@ -37,11 +37,23 @@ public interface SourceRoot {
      * The path is relative to the <abbr>POM</abbr> file.
      *
      * <h4>Default implementation</h4>
-     * The default value is <code>src/{@linkplain #scope() scope}/{@linkplain 
#language() language}</code>
-     * as a relative path. Implementation classes may override this default 
with an absolute path instead.
+     * The default value depends on whether a {@linkplain #module() module 
name} is specified in this source root:
+     * <ul>
+     *   <li>
+     *     If no module name, then the default directory is

Review Comment:
   Reminder: this pull request does not change the convention of non-modular 
projects or projects that do not use the [module source 
hierarchy](https://docs.oracle.com/en/java/javase/24/docs/specs/man/javac.html#module-source-hierarchy):
 for them, the default stay `src/main/java`. Only for projects that use the 
module source hierarchy, we would "flip" from _(nothing that exist currently in 
Maven)_ to `src/java/org.my.module/main`.
   
   The reason for putting `${lang}` before `${module}` is because the module 
names tend to be language-dependent. For example, Java uses URL domain names 
(e.g. `org.apache.maven`) while Python uses [shorter module 
names](https://www.programcreek.com/python/index/module/list), without `org` or 
`com` prefix. If a Maven subproject mixes Java and Python modules, placing the 
modules of the two languages in the same directory is confusing.
   
   The reason for putting `${scope}` after `${module}` is for grouping together 
the files related to each module. This is the same division as Maven 
subprojects (previously named "modules"): each subproject contains main, test, 
resource and pom.xml files. Likewise, each Java module would contain its own 
main, test, resource files, with module-info somewhat playing the role of 
pom.xml. In other words, we are still splitting the projects in modules, but 
shifting from a world where modules are managed by Maven to a world were 
modules are managed by Java.
   
   There is precedents: `${module}/${scope}` is the directory layout of 
NetBeans's Ant modular project, of [Christian Stein's 
blog](https://github.com/sormuras/java-module-patching?tab=readme-ov-file#directory-layout-structure)
 (except for `${lang}`) and of the example given in [Oracle's 
documentation](https://docs.oracle.com/en/java/javase/24/docs/specs/man/javac.html#module-source-hierarchy)
 (except for `src` and `${lang}`).



-- 
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: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to